diff --git a/src/core/checkpoints/index.ts b/src/core/checkpoints/index.ts index 6385b08f4b..70d5c20744 100644 --- a/src/core/checkpoints/index.ts +++ b/src/core/checkpoints/index.ts @@ -384,10 +384,11 @@ export async function checkpointSave(cline: Task, force = false, files?: vscode. const saveKey = `${force}-${filesKey}` // If there's already an ongoing checkpoint save for this exact operation, return the existing promise - if (cline.ongoingCheckpointSaves.has(saveKey)) { + if (cline.ongoingCheckpointSaves && cline.ongoingCheckpointSaves.has(saveKey)) { const provider = cline.providerRef.deref() provider?.log(`[checkpointSave] duplicate checkpoint save detected for ${saveKey}, using existing operation`) - return cline.ongoingCheckpointSaves.get(saveKey) + // Since ongoingCheckpointSaves is a Map, we can get the promise + return (cline.ongoingCheckpointSaves as any).get(saveKey) } const service = await getInitializedCheckpointService(cline) @@ -432,10 +433,16 @@ export async function checkpointSave(cline: Task, force = false, files?: vscode. }) .finally(() => { // Clean up the tracking once completed - cline.ongoingCheckpointSaves.delete(saveKey) + if (cline.ongoingCheckpointSaves) { + cline.ongoingCheckpointSaves.delete(saveKey) + } }) - cline.ongoingCheckpointSaves.set(saveKey, savePromise) + // Initialize as Map if not already + if (!cline.ongoingCheckpointSaves) { + cline.ongoingCheckpointSaves = new Map() as any + } + ;(cline.ongoingCheckpointSaves as any).set(saveKey, savePromise) return savePromise } diff --git a/src/core/webview/__tests__/ClineProvider.spec.ts b/src/core/webview/__tests__/ClineProvider.spec.ts index 400ce50468..d44ab85803 100644 --- a/src/core/webview/__tests__/ClineProvider.spec.ts +++ b/src/core/webview/__tests__/ClineProvider.spec.ts @@ -493,6 +493,7 @@ describe("ClineProvider", () => { const mockState: ExtensionState = { version: "1.0.0", + filesChangedEnabled: false, clineMessages: [], taskHistory: [], shouldShowAnnouncement: false, diff --git a/src/services/file-changes/FCOMessageHandler.ts b/src/services/file-changes/FCOMessageHandler.ts index 3ad4690828..31fb60126e 100644 --- a/src/services/file-changes/FCOMessageHandler.ts +++ b/src/services/file-changes/FCOMessageHandler.ts @@ -110,7 +110,7 @@ export class FCOMessageHandler { if (message.uri && diffFileChangeManager && task?.checkpointService) { // Get the file change information const changeset = diffFileChangeManager.getChanges() - const fileChange = changeset.files.find((f) => f.uri === message.uri) + const fileChange = changeset.files.find((f: any) => f.uri === message.uri) if (fileChange) { try { @@ -300,7 +300,7 @@ export class FCOMessageHandler { // Filter files if specific URIs provided, otherwise use all files const filesToReject = message.uris - ? changeset.files.filter((file) => message.uris!.includes(file.uri)) + ? changeset.files.filter((file: any) => message.uris!.includes(file.uri)) : changeset.files // Get the current task and checkpoint service @@ -429,7 +429,7 @@ export class FCOMessageHandler { */ private async handleFilesChangedEnabled(message: WebviewMessage, task: any): Promise { const filesChangedEnabled = message.bool ?? true - const previousFilesChangedEnabled = this.provider.getGlobalState("filesChangedEnabled") ?? true + const previousFilesChangedEnabled = (this.provider as any).getGlobalState("filesChangedEnabled") ?? true // Update global state await this.provider.contextProxy.setValue("filesChangedEnabled", filesChangedEnabled) diff --git a/src/services/file-changes/updateAfterEdit.ts b/src/services/file-changes/updateAfterEdit.ts index 20ac39c8d1..4f03970729 100644 --- a/src/services/file-changes/updateAfterEdit.ts +++ b/src/services/file-changes/updateAfterEdit.ts @@ -84,8 +84,8 @@ export async function updateFCOAfterEdit(task: Task): Promise { const updatedFiles = [...existingFiles] // Update or add new files with per-file baseline changes - updatedChanges.forEach((newChange) => { - const existingIndex = updatedFiles.findIndex((existing) => existing.uri === newChange.uri) + updatedChanges.forEach((newChange: any) => { + const existingIndex = updatedFiles.findIndex((existing: any) => existing.uri === newChange.uri) if (existingIndex >= 0) { updatedFiles[existingIndex] = newChange // Update existing } else {