From 8f221040b8dd92b4223d2b0ead362f26142167c8 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Mon, 19 May 2025 21:50:12 -0700 Subject: [PATCH 01/21] [Condense] Add a button to condense the task context --- src/core/task/Task.ts | 9 ++++++++- src/core/webview/ClineProvider.ts | 16 ++++++++++++++++ src/core/webview/webviewMessageHandler.ts | 3 +++ src/shared/WebviewMessage.ts | 1 + webview-ui/src/components/chat/TaskActions.tsx | 7 +++++++ webview-ui/src/i18n/locales/en/chat.json | 1 + 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index b301904f7ac..084a7fa1dee 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -76,7 +76,7 @@ import { } from "../checkpoints" import { processUserContentMentions } from "../mentions/processUserContentMentions" import { ApiMessage } from "../task-persistence/apiMessages" -import { getMessagesSinceLastSummary } from "../condense" +import { getMessagesSinceLastSummary, summarizeConversation } from "../condense" import { maybeRemoveImageBlocks } from "../../api/transform/image-cleaning" export type ClineEvents = { @@ -480,6 +480,13 @@ export class Task extends EventEmitter { } } + public async condenseContext(): Promise { + const { messages } = await summarizeConversation(this.apiConversationHistory, this.api) + if (messages !== this.apiConversationHistory) { + this.overwriteApiConversationHistory(messages) + } + } + async say( type: ClineSay, text?: string, diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 1c63c951968..18c62b391e8 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1109,6 +1109,22 @@ export class ClineProvider extends EventEmitter implements await downloadTask(historyItem.ts, apiConversationHistory) } + /* Condenses a task's message history to use fewer tokens. */ + async condenseTaskContext(taskId: string) { + let task = undefined + for (let i = this.clineStack.length - 1; i >= 0; i--) { + if (this.clineStack[i].taskId === taskId) { + task = this.clineStack[i] + break + } + } + if (!task) { + const { historyItem } = await this.getTaskWithId(taskId) + task = await this.initClineWithHistoryItem(historyItem) + } + await task.condenseContext() + } + // this function deletes a task from task hidtory, and deletes it's checkpoints and delete the task folder async deleteTaskWithId(id: string) { try { diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 9c8b90ea8a9..d5aa24a5bec 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -195,6 +195,9 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We case "showTaskWithId": provider.showTaskWithId(message.text!) break + case "condenseTaskContext": + provider.condenseTaskContext(message.text!) + break case "deleteTaskWithId": provider.deleteTaskWithId(message.text!) break diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 22fe5c7d3e3..e2ac66efa0c 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -130,6 +130,7 @@ export interface WebviewMessage { | "searchFiles" | "toggleApiConfigPin" | "setHistoryPreviewCollapsed" + | "condenseTaskContext" text?: string disabled?: boolean askResponse?: ClineAskResponse diff --git a/webview-ui/src/components/chat/TaskActions.tsx b/webview-ui/src/components/chat/TaskActions.tsx index de6f7c28100..0517a1f512e 100644 --- a/webview-ui/src/components/chat/TaskActions.tsx +++ b/webview-ui/src/components/chat/TaskActions.tsx @@ -24,6 +24,13 @@ export const TaskActions = ({ item }: { item: HistoryItem | undefined }) => { {!!item?.size && item.size > 0 && ( <> + + disabled={buttonsDisabled} + onClick={() => vscode.postMessage({ type: "exportCurrentTask" })} + /> {!!item?.size && item.size > 0 && ( <> - - + {deleteTaskId && ( {t("chat:task.apiCost")} ${totalCost?.toFixed(2)} - + )} From 4f1f962f23bf7ba12bf11c4189bcab7b20a6d48b Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:14:41 -0700 Subject: [PATCH 05/21] bring back delete size --- .../src/components/chat/TaskActions.tsx | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/webview-ui/src/components/chat/TaskActions.tsx b/webview-ui/src/components/chat/TaskActions.tsx index f35027468e5..d472dab6425 100644 --- a/webview-ui/src/components/chat/TaskActions.tsx +++ b/webview-ui/src/components/chat/TaskActions.tsx @@ -34,21 +34,23 @@ export const TaskActions = ({ item, buttonsDisabled, handleCondenseContext }: Ta disabled={buttonsDisabled} onClick={() => handleCondenseContext(item.id)} /> - { - e.stopPropagation() +
+ { + e.stopPropagation() - if (e.shiftKey) { - vscode.postMessage({ type: "deleteTaskWithId", text: item.id }) - } else { - setDeleteTaskId(item.id) - } - }}> - {prettyBytes(item.size)} - + if (e.shiftKey) { + vscode.postMessage({ type: "deleteTaskWithId", text: item.id }) + } else { + setDeleteTaskId(item.id) + } + }} + /> + {prettyBytes(item.size)} +
{deleteTaskId && ( Date: Tue, 20 May 2025 11:23:27 -0700 Subject: [PATCH 06/21] account for the system prompt in the context --- src/core/condense/index.ts | 11 +++--- src/core/sliding-window/index.ts | 2 +- src/core/task/Task.ts | 65 +++++++++++++++++--------------- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/core/condense/index.ts b/src/core/condense/index.ts index 5ec839d05c5..c5ab9310694 100644 --- a/src/core/condense/index.ts +++ b/src/core/condense/index.ts @@ -57,12 +57,13 @@ export type SummarizeResponse = { * * @param {ApiMessage[]} messages - The conversation messages * @param {ApiHandler} apiHandler - The API handler to use for token counting. + * @param {string} systemPrompt - The system prompt for API requests, which should be considered in the context token count * @returns {SummarizeResponse} - The result of the summarization operation (see above) */ export async function summarizeConversation( messages: ApiMessage[], apiHandler: ApiHandler, - systemPrompt?: string, + systemPrompt: string, ): Promise { const response: SummarizeResponse = { messages, cost: 0, summary: "" } const messagesToSummarize = getMessagesSinceLastSummary(messages.slice(0, -N_MESSAGES_TO_KEEP)) @@ -111,10 +112,10 @@ export async function summarizeConversation( // Count the tokens in the context for the next API request // We only estimate the tokens in summaryMesage if outputTokens is 0, otherwise we use outputTokens - const contextMessages = outputTokens ? [...keepMessages] : [summaryMessage, ...keepMessages] - if (systemPrompt) { - contextMessages.unshift({ role: "user", content: systemPrompt }) - } + const systemPromptMessage: ApiMessage = { role: "user", content: systemPrompt } + const contextMessages = outputTokens + ? [systemPromptMessage, ...keepMessages] + : [systemPromptMessage, summaryMessage, ...keepMessages] const contextBlocks = contextMessages.flatMap((message) => typeof message.content === "string" ? [{ text: message.content, type: "text" as const }] : message.content, ) diff --git a/src/core/sliding-window/index.ts b/src/core/sliding-window/index.ts index 6b42783c447..4c2f17e8161 100644 --- a/src/core/sliding-window/index.ts +++ b/src/core/sliding-window/index.ts @@ -64,7 +64,7 @@ type TruncateOptions = { maxTokens?: number | null apiHandler: ApiHandler autoCondenseContext?: boolean - systemPrompt?: string + systemPrompt: string } type TruncateResponse = SummarizeResponse & { prevContextTokens: number } diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 4613d59072b..25c924a835c 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -481,12 +481,13 @@ export class Task extends EventEmitter { } public async condenseContext(): Promise { + const systemPrompt = await this.getSystemPrompt() const { messages, summary, cost, newContextTokens = 0, - } = await summarizeConversation(this.apiConversationHistory, this.api) + } = await summarizeConversation(this.apiConversationHistory, this.api, systemPrompt) if (!summary) { return } @@ -1399,35 +1400,9 @@ export class Task extends EventEmitter { } } - public async *attemptApiRequest(retryAttempt: number = 0): ApiStream { + private async getSystemPrompt(): Promise { + const { mcpEnabled } = (await this.providerRef.deref()?.getState()) ?? {} let mcpHub: McpHub | undefined - - const { apiConfiguration, mcpEnabled, autoApprovalEnabled, alwaysApproveResubmit, requestDelaySeconds } = - (await this.providerRef.deref()?.getState()) ?? {} - - let rateLimitDelay = 0 - - // Only apply rate limiting if this isn't the first request - if (this.lastApiRequestTime) { - const now = Date.now() - const timeSinceLastRequest = now - this.lastApiRequestTime - const rateLimit = apiConfiguration?.rateLimitSeconds || 0 - rateLimitDelay = Math.ceil(Math.max(0, rateLimit * 1000 - timeSinceLastRequest) / 1000) - } - - // Only show rate limiting message if we're not retrying. If retrying, we'll include the delay there. - if (rateLimitDelay > 0 && retryAttempt === 0) { - // Show countdown timer - for (let i = rateLimitDelay; i > 0; i--) { - const delayMessage = `Rate limiting for ${i} seconds...` - await this.say("api_req_retry_delayed", delayMessage, undefined, true) - await delay(1000) - } - } - - // Update last request time before making the request - this.lastApiRequestTime = Date.now() - if (mcpEnabled ?? true) { const provider = this.providerRef.deref() @@ -1463,7 +1438,7 @@ export class Task extends EventEmitter { const { customModes } = (await this.providerRef.deref()?.getState()) ?? {} - const systemPrompt = await (async () => { + return await (async () => { const provider = this.providerRef.deref() if (!provider) { @@ -1488,6 +1463,36 @@ export class Task extends EventEmitter { rooIgnoreInstructions, ) })() + } + + public async *attemptApiRequest(retryAttempt: number = 0): ApiStream { + const { apiConfiguration, autoApprovalEnabled, alwaysApproveResubmit, requestDelaySeconds, experiments } = + (await this.providerRef.deref()?.getState()) ?? {} + + let rateLimitDelay = 0 + + // Only apply rate limiting if this isn't the first request + if (this.lastApiRequestTime) { + const now = Date.now() + const timeSinceLastRequest = now - this.lastApiRequestTime + const rateLimit = apiConfiguration?.rateLimitSeconds || 0 + rateLimitDelay = Math.ceil(Math.max(0, rateLimit * 1000 - timeSinceLastRequest) / 1000) + } + + // Only show rate limiting message if we're not retrying. If retrying, we'll include the delay there. + if (rateLimitDelay > 0 && retryAttempt === 0) { + // Show countdown timer + for (let i = rateLimitDelay; i > 0; i--) { + const delayMessage = `Rate limiting for ${i} seconds...` + await this.say("api_req_retry_delayed", delayMessage, undefined, true) + await delay(1000) + } + } + + // Update last request time before making the request + this.lastApiRequestTime = Date.now() + + const systemPrompt = await this.getSystemPrompt() const { contextTokens } = this.getTokenUsage() if (contextTokens) { From 5d2e25a3d71791853f618a4f5be8a5ec181c29fb Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:26:48 -0700 Subject: [PATCH 07/21] update tests to use systemPrompt --- src/core/condense/__tests__/index.test.ts | 13 +++++++----- .../__tests__/sliding-window.test.ts | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/core/condense/__tests__/index.test.ts b/src/core/condense/__tests__/index.test.ts index e06ea4197d3..86afe2a8c4c 100644 --- a/src/core/condense/__tests__/index.test.ts +++ b/src/core/condense/__tests__/index.test.ts @@ -97,13 +97,16 @@ describe("summarizeConversation", () => { } as unknown as ApiHandler }) + // Default system prompt for tests + const defaultSystemPrompt = "You are a helpful assistant." + it("should not summarize when there are not enough messages", async () => { const messages: ApiMessage[] = [ { role: "user", content: "Hello", ts: 1 }, { role: "assistant", content: "Hi there", ts: 2 }, ] - const result = await summarizeConversation(messages, mockApiHandler) + const result = await summarizeConversation(messages, mockApiHandler, defaultSystemPrompt) expect(result.messages).toEqual(messages) expect(result.cost).toBe(0) expect(result.summary).toBe("") @@ -122,7 +125,7 @@ describe("summarizeConversation", () => { { role: "user", content: "Tell me more", ts: 7 }, ] - const result = await summarizeConversation(messages, mockApiHandler) + const result = await summarizeConversation(messages, mockApiHandler, defaultSystemPrompt) expect(result.messages).toEqual(messages) expect(result.cost).toBe(0) expect(result.summary).toBe("") @@ -141,7 +144,7 @@ describe("summarizeConversation", () => { { role: "user", content: "Tell me more", ts: 7 }, ] - const result = await summarizeConversation(messages, mockApiHandler) + const result = await summarizeConversation(messages, mockApiHandler, defaultSystemPrompt) // Check that the API was called correctly expect(mockApiHandler.createMessage).toHaveBeenCalled() @@ -199,7 +202,7 @@ describe("summarizeConversation", () => { return messages.map(({ role, content }: { role: string; content: any }) => ({ role, content })) }) - const result = await summarizeConversation(messages, mockApiHandler) + const result = await summarizeConversation(messages, mockApiHandler, defaultSystemPrompt) // Should return original messages when summary is empty expect(result.messages).toEqual(messages) @@ -222,7 +225,7 @@ describe("summarizeConversation", () => { { role: "user", content: "Tell me more", ts: 7 }, ] - await summarizeConversation(messages, mockApiHandler) + await summarizeConversation(messages, mockApiHandler, defaultSystemPrompt) // Verify the final request message const expectedFinalMessage = { diff --git a/src/core/sliding-window/__tests__/sliding-window.test.ts b/src/core/sliding-window/__tests__/sliding-window.test.ts index fe3b71f4eb9..810d899ae37 100644 --- a/src/core/sliding-window/__tests__/sliding-window.test.ts +++ b/src/core/sliding-window/__tests__/sliding-window.test.ts @@ -248,6 +248,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) // Check the new return type @@ -276,6 +277,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result).toEqual({ @@ -302,6 +304,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo1.contextWindow, maxTokens: modelInfo1.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) const result2 = await truncateConversationIfNeeded({ @@ -310,6 +313,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo2.contextWindow, maxTokens: modelInfo2.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result1.messages).toEqual(result2.messages) @@ -325,6 +329,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo1.contextWindow, maxTokens: modelInfo1.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) const result4 = await truncateConversationIfNeeded({ @@ -333,6 +338,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo2.contextWindow, maxTokens: modelInfo2.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result3.messages).toEqual(result4.messages) @@ -363,6 +369,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo.contextWindow, maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(resultWithSmall).toEqual({ messages: messagesWithSmallContent, @@ -392,6 +399,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo.contextWindow, maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(resultWithLarge.messages).not.toEqual(messagesWithLargeContent) // Should truncate expect(resultWithLarge.summary).toBe("") @@ -414,6 +422,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo.contextWindow, maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(resultWithVeryLarge.messages).not.toEqual(messagesWithVeryLargeContent) // Should truncate expect(resultWithVeryLarge.summary).toBe("") @@ -439,6 +448,7 @@ describe("truncateConversationIfNeeded", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result).toEqual({ messages: expectedResult, @@ -524,6 +534,7 @@ describe("truncateConversationIfNeeded", () => { maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, autoCondenseContext: true, + systemPrompt: "System prompt", }) // Verify summarizeConversation was called @@ -559,6 +570,7 @@ describe("truncateConversationIfNeeded", () => { maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, autoCondenseContext: false, + systemPrompt: "System prompt", }) // Verify summarizeConversation was not called @@ -612,6 +624,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result1).toEqual({ messages: messagesWithSmallContent, @@ -627,6 +640,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result2.messages).not.toEqual(messagesWithSmallContent) expect(result2.messages.length).toBe(3) // Truncated with 0.5 fraction @@ -650,6 +664,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result1).toEqual({ messages: messagesWithSmallContent, @@ -665,6 +680,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result2.messages).not.toEqual(messagesWithSmallContent) expect(result2.messages.length).toBe(3) // Truncated with 0.5 fraction @@ -687,6 +703,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result1.messages).toEqual(messagesWithSmallContent) @@ -697,6 +714,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result2).not.toEqual(messagesWithSmallContent) expect(result2.messages.length).toBe(3) // Truncated with 0.5 fraction @@ -717,6 +735,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result1.messages).toEqual(messagesWithSmallContent) @@ -727,6 +746,7 @@ describe("getMaxTokens", () => { contextWindow: modelInfo.contextWindow, maxTokens: modelInfo.maxTokens, apiHandler: mockApiHandler, + systemPrompt: "System prompt", }) expect(result2).not.toEqual(messagesWithSmallContent) expect(result2.messages.length).toBe(3) // Truncated with 0.5 fraction From d677f767ec9f6792f89ebbc3aa369232b255ec38 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:34:37 -0700 Subject: [PATCH 08/21] add type --- src/core/webview/ClineProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 70704974783..14108b16579 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1111,7 +1111,7 @@ export class ClineProvider extends EventEmitter implements /* Condenses a task's message history to use fewer tokens. */ async condenseTaskContext(taskId: string) { - let task = undefined + let task: Task | undefined for (let i = this.clineStack.length - 1; i >= 0; i--) { if (this.clineStack[i].taskId === taskId) { task = this.clineStack[i] From 975911d2a092cf41629abc87db1a2f3c69f9fe55 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:39:36 -0700 Subject: [PATCH 09/21] translations --- webview-ui/src/i18n/locales/ca/chat.json | 3 ++- webview-ui/src/i18n/locales/de/chat.json | 3 ++- webview-ui/src/i18n/locales/es/chat.json | 3 ++- webview-ui/src/i18n/locales/fr/chat.json | 3 ++- webview-ui/src/i18n/locales/hi/chat.json | 3 ++- webview-ui/src/i18n/locales/it/chat.json | 3 ++- webview-ui/src/i18n/locales/ko/chat.json | 3 ++- webview-ui/src/i18n/locales/nl/chat.json | 3 ++- webview-ui/src/i18n/locales/pl/chat.json | 3 ++- webview-ui/src/i18n/locales/pt-BR/chat.json | 3 ++- webview-ui/src/i18n/locales/ru/chat.json | 3 ++- webview-ui/src/i18n/locales/tr/chat.json | 3 ++- webview-ui/src/i18n/locales/vi/chat.json | 3 ++- webview-ui/src/i18n/locales/zh-CN/chat.json | 3 ++- webview-ui/src/i18n/locales/zh-TW/chat.json | 3 ++- 15 files changed, 30 insertions(+), 15 deletions(-) diff --git a/webview-ui/src/i18n/locales/ca/chat.json b/webview-ui/src/i18n/locales/ca/chat.json index dd0d89ced5f..c7ff8b214e1 100644 --- a/webview-ui/src/i18n/locales/ca/chat.json +++ b/webview-ui/src/i18n/locales/ca/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Finestra de context:", "closeAndStart": "Tancar tasca i iniciar-ne una de nova", "export": "Exportar historial de tasques", - "delete": "Eliminar tasca (Shift + Clic per ometre confirmació)" + "delete": "Eliminar tasca (Shift + Clic per ometre confirmació)", + "condenseContext": "Condensar context de la tasca" }, "unpin": "Desfixar", "pin": "Fixar", diff --git a/webview-ui/src/i18n/locales/de/chat.json b/webview-ui/src/i18n/locales/de/chat.json index f683ada7d3d..a3f8a3efd9e 100644 --- a/webview-ui/src/i18n/locales/de/chat.json +++ b/webview-ui/src/i18n/locales/de/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Kontextfenster:", "closeAndStart": "Aufgabe schließen und neue starten", "export": "Aufgabenverlauf exportieren", - "delete": "Aufgabe löschen (Shift + Klick zum Überspringen der Bestätigung)" + "delete": "Aufgabe löschen (Shift + Klick zum Überspringen der Bestätigung)", + "condenseContext": "Task-Kontext komprimieren" }, "unpin": "Lösen von oben", "pin": "Anheften", diff --git a/webview-ui/src/i18n/locales/es/chat.json b/webview-ui/src/i18n/locales/es/chat.json index 7de76382416..bcab53faa81 100644 --- a/webview-ui/src/i18n/locales/es/chat.json +++ b/webview-ui/src/i18n/locales/es/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Longitud del contexto:", "closeAndStart": "Cerrar tarea e iniciar una nueva", "export": "Exportar historial de tareas", - "delete": "Eliminar tarea (Shift + Clic para omitir confirmación)" + "delete": "Eliminar tarea (Shift + Clic para omitir confirmación)", + "condenseContext": "Condensar contexto de la tarea" }, "unpin": "Desfijar", "pin": "Fijar", diff --git a/webview-ui/src/i18n/locales/fr/chat.json b/webview-ui/src/i18n/locales/fr/chat.json index bb1219e7ac1..353e57f468e 100644 --- a/webview-ui/src/i18n/locales/fr/chat.json +++ b/webview-ui/src/i18n/locales/fr/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Durée du contexte :", "closeAndStart": "Fermer la tâche et en commencer une nouvelle", "export": "Exporter l'historique des tâches", - "delete": "Supprimer la tâche (Shift + Clic pour ignorer la confirmation)" + "delete": "Supprimer la tâche (Shift + Clic pour ignorer la confirmation)", + "condenseContext": "Condenser le contexte de la tâche" }, "unpin": "Désépingler", "pin": "Épingler", diff --git a/webview-ui/src/i18n/locales/hi/chat.json b/webview-ui/src/i18n/locales/hi/chat.json index 58bbd96b037..7fdcc83afa3 100644 --- a/webview-ui/src/i18n/locales/hi/chat.json +++ b/webview-ui/src/i18n/locales/hi/chat.json @@ -10,7 +10,8 @@ "contextWindow": "संदर्भ लंबाई:", "closeAndStart": "कार्य बंद करें और नया शुरू करें", "export": "कार्य इतिहास निर्यात करें", - "delete": "कार्य हटाएं (पुष्टि को छोड़ने के लिए Shift + क्लिक)" + "delete": "कार्य हटाएं (पुष्टि को छोड़ने के लिए Shift + क्लिक)", + "condenseContext": "कार्य संदर्भ संघनित करें" }, "unpin": "पिन करें", "pin": "अवपिन करें", diff --git a/webview-ui/src/i18n/locales/it/chat.json b/webview-ui/src/i18n/locales/it/chat.json index 40a80ed188c..c00ffda4ab8 100644 --- a/webview-ui/src/i18n/locales/it/chat.json +++ b/webview-ui/src/i18n/locales/it/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Lunghezza del contesto:", "closeAndStart": "Chiudi attività e iniziane una nuova", "export": "Esporta cronologia attività", - "delete": "Elimina attività (Shift + Clic per saltare la conferma)" + "delete": "Elimina attività (Shift + Clic per saltare la conferma)", + "condenseContext": "Condensa contesto attività" }, "unpin": "Rilascia", "pin": "Fissa", diff --git a/webview-ui/src/i18n/locales/ko/chat.json b/webview-ui/src/i18n/locales/ko/chat.json index b79038367ba..7e7d897cf08 100644 --- a/webview-ui/src/i18n/locales/ko/chat.json +++ b/webview-ui/src/i18n/locales/ko/chat.json @@ -10,7 +10,8 @@ "contextWindow": "컨텍스트 창:", "closeAndStart": "작업 닫고 새 작업 시작", "export": "작업 기록 내보내기", - "delete": "작업 삭제 (Shift + 클릭으로 확인 생략)" + "delete": "작업 삭제 (Shift + 클릭으로 확인 생략)", + "condenseContext": "작업 컨텍스트 압축" }, "unpin": "고정 해제하기", "pin": "고정하기", diff --git a/webview-ui/src/i18n/locales/nl/chat.json b/webview-ui/src/i18n/locales/nl/chat.json index f69ce8b69cd..931ebff39ed 100644 --- a/webview-ui/src/i18n/locales/nl/chat.json +++ b/webview-ui/src/i18n/locales/nl/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Contextlengte:", "closeAndStart": "Taak sluiten en een nieuwe starten", "export": "Taakgeschiedenis exporteren", - "delete": "Taak verwijderen (Shift + Klik om bevestiging over te slaan)" + "delete": "Taak verwijderen (Shift + Klik om bevestiging over te slaan)", + "condenseContext": "Taakcontext samenvatten" }, "unpin": "Losmaken", "pin": "Vastmaken", diff --git a/webview-ui/src/i18n/locales/pl/chat.json b/webview-ui/src/i18n/locales/pl/chat.json index c21898d50a5..d6ce89ec605 100644 --- a/webview-ui/src/i18n/locales/pl/chat.json +++ b/webview-ui/src/i18n/locales/pl/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Okno kontekstu:", "closeAndStart": "Zamknij zadanie i rozpocznij nowe", "export": "Eksportuj historię zadań", - "delete": "Usuń zadanie (Shift + Kliknięcie, aby pominąć potwierdzenie)" + "delete": "Usuń zadanie (Shift + Kliknięcie, aby pominąć potwierdzenie)", + "condenseContext": "Skondensuj kontekst zadania" }, "unpin": "Odepnij", "pin": "Przypnij", diff --git a/webview-ui/src/i18n/locales/pt-BR/chat.json b/webview-ui/src/i18n/locales/pt-BR/chat.json index d25cc9962fc..26c185cf45f 100644 --- a/webview-ui/src/i18n/locales/pt-BR/chat.json +++ b/webview-ui/src/i18n/locales/pt-BR/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Janela de contexto:", "closeAndStart": "Fechar tarefa e iniciar nova", "export": "Exportar histórico de tarefas", - "delete": "Excluir tarefa (Shift + Clique para pular confirmação)" + "delete": "Excluir tarefa (Shift + Clique para pular confirmação)", + "condenseContext": "Condensar contexto da tarefa" }, "unpin": "Desfixar", "pin": "Fixar", diff --git a/webview-ui/src/i18n/locales/ru/chat.json b/webview-ui/src/i18n/locales/ru/chat.json index 6e2345f8223..41d6aa2fa1e 100644 --- a/webview-ui/src/i18n/locales/ru/chat.json +++ b/webview-ui/src/i18n/locales/ru/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Длина контекста:", "closeAndStart": "Закрыть задачу и начать новую", "export": "Экспортировать историю задач", - "delete": "Удалить задачу (Shift + клик для пропуска подтверждения)" + "delete": "Удалить задачу (Shift + клик для пропуска подтверждения)", + "condenseContext": "Сжать контекст задачи" }, "unpin": "Открепить", "pin": "Закрепить", diff --git a/webview-ui/src/i18n/locales/tr/chat.json b/webview-ui/src/i18n/locales/tr/chat.json index d0171862581..068776bae51 100644 --- a/webview-ui/src/i18n/locales/tr/chat.json +++ b/webview-ui/src/i18n/locales/tr/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Bağlam Uzunluğu:", "closeAndStart": "Görevi kapat ve yeni bir görev başlat", "export": "Görev geçmişini dışa aktar", - "delete": "Görevi sil (Onayı atlamak için Shift + Tıkla)" + "delete": "Görevi sil (Onayı atlamak için Shift + Tıkla)", + "condenseContext": "Görev bağlamını yoğunlaştır" }, "unpin": "Sabitlemeyi iptal et", "pin": "Sabitle", diff --git a/webview-ui/src/i18n/locales/vi/chat.json b/webview-ui/src/i18n/locales/vi/chat.json index 62bed81fc43..ef343faacb8 100644 --- a/webview-ui/src/i18n/locales/vi/chat.json +++ b/webview-ui/src/i18n/locales/vi/chat.json @@ -10,7 +10,8 @@ "contextWindow": "Chiều dài bối cảnh:", "closeAndStart": "Đóng nhiệm vụ và bắt đầu nhiệm vụ mới", "export": "Xuất lịch sử nhiệm vụ", - "delete": "Xóa nhiệm vụ (Shift + Click để bỏ qua xác nhận)" + "delete": "Xóa nhiệm vụ (Shift + Click để bỏ qua xác nhận)", + "condenseContext": "Cô đọng ngữ cảnh tác vụ" }, "unpin": "Bỏ ghim khỏi đầu", "pin": "Ghim lên đầu", diff --git a/webview-ui/src/i18n/locales/zh-CN/chat.json b/webview-ui/src/i18n/locales/zh-CN/chat.json index 31993895ac6..41de2bf70af 100644 --- a/webview-ui/src/i18n/locales/zh-CN/chat.json +++ b/webview-ui/src/i18n/locales/zh-CN/chat.json @@ -10,7 +10,8 @@ "contextWindow": "上下文长度:", "closeAndStart": "关闭任务并开始新任务", "export": "导出任务历史", - "delete": "删除任务(Shift + 点击跳过确认)" + "delete": "删除任务(Shift + 点击跳过确认)", + "condenseContext": "压缩任务上下文" }, "unpin": "取消置顶", "pin": "置顶", diff --git a/webview-ui/src/i18n/locales/zh-TW/chat.json b/webview-ui/src/i18n/locales/zh-TW/chat.json index b3f94b9d819..2d92d57749d 100644 --- a/webview-ui/src/i18n/locales/zh-TW/chat.json +++ b/webview-ui/src/i18n/locales/zh-TW/chat.json @@ -10,7 +10,8 @@ "contextWindow": "上下文長度:", "closeAndStart": "關閉現有工作並開始一項新的工作", "export": "匯出工作紀錄", - "delete": "刪除工作(按住 Shift 並點選可跳過確認)" + "delete": "刪除工作(按住 Shift 並點選可跳過確認)", + "condenseContext": "壓縮工作上下文" }, "unpin": "取消置頂", "pin": "置頂", From 6253c6265b42b8aa57879d2202bdbb2f14717f59 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:43:16 -0700 Subject: [PATCH 10/21] nit --- webview-ui/src/components/chat/TaskActions.tsx | 2 +- webview-ui/src/components/chat/TaskHeader.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webview-ui/src/components/chat/TaskActions.tsx b/webview-ui/src/components/chat/TaskActions.tsx index d472dab6425..2496cb585f9 100644 --- a/webview-ui/src/components/chat/TaskActions.tsx +++ b/webview-ui/src/components/chat/TaskActions.tsx @@ -10,7 +10,7 @@ import { IconButton } from "./IconButton" interface TaskActionsProps { item?: HistoryItem - buttonsDisabled?: boolean + buttonsDisabled: boolean handleCondenseContext: (taskId: string) => void } diff --git a/webview-ui/src/components/chat/TaskHeader.tsx b/webview-ui/src/components/chat/TaskHeader.tsx index 965ab1079cc..5270db1107e 100644 --- a/webview-ui/src/components/chat/TaskHeader.tsx +++ b/webview-ui/src/components/chat/TaskHeader.tsx @@ -28,7 +28,7 @@ export interface TaskHeaderProps { cacheReads?: number totalCost: number contextTokens: number - buttonsDisabled?: boolean + buttonsDisabled: boolean handleCondenseContext: (taskId: string) => void onClose: () => void } @@ -159,8 +159,8 @@ const TaskHeader = ({ {!totalCost && ( )} From fb242587d8c6a179a19711ba77f148f63fdfcc0d Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:46:09 -0700 Subject: [PATCH 11/21] update tests --- webview-ui/src/components/chat/__tests__/TaskHeader.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webview-ui/src/components/chat/__tests__/TaskHeader.test.tsx b/webview-ui/src/components/chat/__tests__/TaskHeader.test.tsx index f9fb71b0660..27704a2ce5f 100644 --- a/webview-ui/src/components/chat/__tests__/TaskHeader.test.tsx +++ b/webview-ui/src/components/chat/__tests__/TaskHeader.test.tsx @@ -40,6 +40,8 @@ describe("TaskHeader", () => { doesModelSupportPromptCache: true, totalCost: 0.05, contextTokens: 200, + buttonsDisabled: false, + handleCondenseContext: jest.fn(), onClose: jest.fn(), } From c56c32b916a4ee21b9d04b25031ee390e422f6c2 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 11:54:07 -0700 Subject: [PATCH 12/21] filter to the current task --- src/core/webview/ClineProvider.ts | 2 +- webview-ui/src/components/chat/ChatView.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 14108b16579..004fb2165ca 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1123,7 +1123,7 @@ export class ClineProvider extends EventEmitter implements task = await this.initClineWithHistoryItem(historyItem) } await task.condenseContext() - await this.postMessageToWebview({ type: "condenseTaskContextResponse" }) + await this.postMessageToWebview({ type: "condenseTaskContextResponse", text: task.taskId }) } // this function deletes a task from task hidtory, and deletes it's checkpoints and delete the task folder diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 682d0533fd6..451eb6039e7 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -64,6 +64,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction Date: Tue, 20 May 2025 11:54:35 -0700 Subject: [PATCH 13/21] nit --- webview-ui/src/components/chat/ChatView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 451eb6039e7..f541f9966c9 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -586,7 +586,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction Date: Tue, 20 May 2025 11:55:09 -0700 Subject: [PATCH 14/21] refactor --- webview-ui/src/components/chat/ChatView.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index f541f9966c9..f2f205edf0e 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -585,13 +585,12 @@ const ChatViewComponent: React.ForwardRefRenderFunction Date: Tue, 20 May 2025 11:55:58 -0700 Subject: [PATCH 15/21] nit --- src/core/webview/ClineProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 004fb2165ca..62a7c5289e9 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1123,7 +1123,7 @@ export class ClineProvider extends EventEmitter implements task = await this.initClineWithHistoryItem(historyItem) } await task.condenseContext() - await this.postMessageToWebview({ type: "condenseTaskContextResponse", text: task.taskId }) + await this.postMessageToWebview({ type: "condenseTaskContextResponse", text: taskId }) } // this function deletes a task from task hidtory, and deletes it's checkpoints and delete the task folder From 74725f9d163cff86b6805909e0cc511d7093be96 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 12:33:57 -0700 Subject: [PATCH 16/21] non interactive option --- src/core/task/Task.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 25c924a835c..f88812e0c66 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -508,7 +508,7 @@ export class Task extends EventEmitter { false /* partial */, undefined /* checkpoint */, undefined /* progressStatus */, - undefined /* options */, + { isNonInteractive: true } /* options */, contextCondense, ) } @@ -1531,7 +1531,7 @@ export class Task extends EventEmitter { false /* partial */, undefined /* checkpoint */, undefined /* progressStatus */, - undefined /* options */, + { isNonInteractive: true } /* options */, contextCondense, ) } From e7fff36f634988053d6e2862aad2241263a5275d Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 12:45:54 -0700 Subject: [PATCH 17/21] simplify chat summary UI --- webview-ui/src/components/chat/ContextCondenseRow.tsx | 5 +---- webview-ui/src/i18n/locales/ca/chat.json | 1 - webview-ui/src/i18n/locales/de/chat.json | 1 - webview-ui/src/i18n/locales/en/chat.json | 1 - webview-ui/src/i18n/locales/es/chat.json | 1 - webview-ui/src/i18n/locales/fr/chat.json | 1 - webview-ui/src/i18n/locales/hi/chat.json | 1 - webview-ui/src/i18n/locales/it/chat.json | 1 - webview-ui/src/i18n/locales/ja/chat.json | 1 - webview-ui/src/i18n/locales/ko/chat.json | 1 - webview-ui/src/i18n/locales/nl/chat.json | 1 - webview-ui/src/i18n/locales/pl/chat.json | 1 - webview-ui/src/i18n/locales/pt-BR/chat.json | 1 - webview-ui/src/i18n/locales/ru/chat.json | 1 - webview-ui/src/i18n/locales/tr/chat.json | 1 - webview-ui/src/i18n/locales/vi/chat.json | 1 - webview-ui/src/i18n/locales/zh-CN/chat.json | 1 - webview-ui/src/i18n/locales/zh-TW/chat.json | 1 - 18 files changed, 1 insertion(+), 21 deletions(-) diff --git a/webview-ui/src/components/chat/ContextCondenseRow.tsx b/webview-ui/src/components/chat/ContextCondenseRow.tsx index 52045df7f7e..a2133b7165b 100644 --- a/webview-ui/src/components/chat/ContextCondenseRow.tsx +++ b/webview-ui/src/components/chat/ContextCondenseRow.tsx @@ -27,10 +27,7 @@ export const ContextCondenseRow = ({ cost, prevContextTokens, newContextTokens, {isExpanded && (
-

{t("chat:contextCondense.conversationSummary")}

-
- -
+
)} diff --git a/webview-ui/src/i18n/locales/ca/chat.json b/webview-ui/src/i18n/locales/ca/chat.json index c7ff8b214e1..186fefddf60 100644 --- a/webview-ui/src/i18n/locales/ca/chat.json +++ b/webview-ui/src/i18n/locales/ca/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Context condensat", - "conversationSummary": "Resum de la conversa", "tokens": "tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/de/chat.json b/webview-ui/src/i18n/locales/de/chat.json index a3f8a3efd9e..a44247326a5 100644 --- a/webview-ui/src/i18n/locales/de/chat.json +++ b/webview-ui/src/i18n/locales/de/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Kontext komprimiert", - "conversationSummary": "Gesprächszusammenfassung", "tokens": "Tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/en/chat.json b/webview-ui/src/i18n/locales/en/chat.json index cf53d9d7c58..30e34bd4683 100644 --- a/webview-ui/src/i18n/locales/en/chat.json +++ b/webview-ui/src/i18n/locales/en/chat.json @@ -132,7 +132,6 @@ }, "contextCondense": { "title": "Context Condensed", - "conversationSummary": "Conversation Summary", "tokens": "tokens" }, "instructions": { diff --git a/webview-ui/src/i18n/locales/es/chat.json b/webview-ui/src/i18n/locales/es/chat.json index bcab53faa81..17af37ee6ce 100644 --- a/webview-ui/src/i18n/locales/es/chat.json +++ b/webview-ui/src/i18n/locales/es/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Contexto condensado", - "conversationSummary": "Resumen de la conversación", "tokens": "tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/fr/chat.json b/webview-ui/src/i18n/locales/fr/chat.json index 353e57f468e..fe60345a9d9 100644 --- a/webview-ui/src/i18n/locales/fr/chat.json +++ b/webview-ui/src/i18n/locales/fr/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Contexte condensé", - "conversationSummary": "Résumé de la conversation", "tokens": "tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/hi/chat.json b/webview-ui/src/i18n/locales/hi/chat.json index 7fdcc83afa3..ee213d9093b 100644 --- a/webview-ui/src/i18n/locales/hi/chat.json +++ b/webview-ui/src/i18n/locales/hi/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "संदर्भ संक्षिप्त किया गया", - "conversationSummary": "वार्तालाप का सारांश", "tokens": "टोकन" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/it/chat.json b/webview-ui/src/i18n/locales/it/chat.json index c00ffda4ab8..7becab5fe1f 100644 --- a/webview-ui/src/i18n/locales/it/chat.json +++ b/webview-ui/src/i18n/locales/it/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Contesto condensato", - "conversationSummary": "Riepilogo della conversazione", "tokens": "token" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/ja/chat.json b/webview-ui/src/i18n/locales/ja/chat.json index 8bb0b09a1ef..0b963e0a8b0 100644 --- a/webview-ui/src/i18n/locales/ja/chat.json +++ b/webview-ui/src/i18n/locales/ja/chat.json @@ -200,7 +200,6 @@ }, "contextCondense": { "title": "コンテキスト要約", - "conversationSummary": "会話の要約", "tokens": "トークン" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/ko/chat.json b/webview-ui/src/i18n/locales/ko/chat.json index 7e7d897cf08..f9855ccf061 100644 --- a/webview-ui/src/i18n/locales/ko/chat.json +++ b/webview-ui/src/i18n/locales/ko/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "컨텍스트 요약됨", - "conversationSummary": "대화 요약", "tokens": "토큰" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/nl/chat.json b/webview-ui/src/i18n/locales/nl/chat.json index 931ebff39ed..c38b933d81f 100644 --- a/webview-ui/src/i18n/locales/nl/chat.json +++ b/webview-ui/src/i18n/locales/nl/chat.json @@ -211,7 +211,6 @@ }, "contextCondense": { "title": "Context samengevat", - "conversationSummary": "Gespreksoverzicht", "tokens": "tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/pl/chat.json b/webview-ui/src/i18n/locales/pl/chat.json index d6ce89ec605..7816db0cf68 100644 --- a/webview-ui/src/i18n/locales/pl/chat.json +++ b/webview-ui/src/i18n/locales/pl/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Kontekst skondensowany", - "conversationSummary": "Podsumowanie rozmowy", "tokens": "tokeny" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/pt-BR/chat.json b/webview-ui/src/i18n/locales/pt-BR/chat.json index 26c185cf45f..03c940230e6 100644 --- a/webview-ui/src/i18n/locales/pt-BR/chat.json +++ b/webview-ui/src/i18n/locales/pt-BR/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Contexto condensado", - "conversationSummary": "Resumo da conversa", "tokens": "tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/ru/chat.json b/webview-ui/src/i18n/locales/ru/chat.json index 41d6aa2fa1e..c7ec414e3a7 100644 --- a/webview-ui/src/i18n/locales/ru/chat.json +++ b/webview-ui/src/i18n/locales/ru/chat.json @@ -211,7 +211,6 @@ }, "contextCondense": { "title": "Контекст сжат", - "conversationSummary": "Сводка разговора", "tokens": "токены" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/tr/chat.json b/webview-ui/src/i18n/locales/tr/chat.json index 068776bae51..115fa849edd 100644 --- a/webview-ui/src/i18n/locales/tr/chat.json +++ b/webview-ui/src/i18n/locales/tr/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Bağlam Özetlendi", - "conversationSummary": "Konuşma Özeti", "tokens": "token" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/vi/chat.json b/webview-ui/src/i18n/locales/vi/chat.json index ef343faacb8..31f4d243510 100644 --- a/webview-ui/src/i18n/locales/vi/chat.json +++ b/webview-ui/src/i18n/locales/vi/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "Ngữ cảnh đã tóm tắt", - "conversationSummary": "Tóm tắt cuộc hội thoại", "tokens": "token" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/zh-CN/chat.json b/webview-ui/src/i18n/locales/zh-CN/chat.json index 41de2bf70af..d4fed459f64 100644 --- a/webview-ui/src/i18n/locales/zh-CN/chat.json +++ b/webview-ui/src/i18n/locales/zh-CN/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "上下文已压缩", - "conversationSummary": "对话摘要", "tokens": "tokens" }, "followUpSuggest": { diff --git a/webview-ui/src/i18n/locales/zh-TW/chat.json b/webview-ui/src/i18n/locales/zh-TW/chat.json index 2d92d57749d..7e83228beeb 100644 --- a/webview-ui/src/i18n/locales/zh-TW/chat.json +++ b/webview-ui/src/i18n/locales/zh-TW/chat.json @@ -201,7 +201,6 @@ }, "contextCondense": { "title": "上下文已壓縮", - "conversationSummary": "對話摘要", "tokens": "tokens" }, "followUpSuggest": { From 329f7cd8f87619a5312c7503c95b89d16130576f Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 12:46:36 -0700 Subject: [PATCH 18/21] changeset --- .changeset/tired-dogs-worry.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tired-dogs-worry.md diff --git a/.changeset/tired-dogs-worry.md b/.changeset/tired-dogs-worry.md new file mode 100644 index 00000000000..96bc50f8544 --- /dev/null +++ b/.changeset/tired-dogs-worry.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Adds a button to intelligently condense the context window From 45e1b7085a4732d1e9d5ddbab4e12f0dde9c49d9 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 12:50:39 -0700 Subject: [PATCH 19/21] nit --- webview-ui/src/i18n/locales/ja/chat.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/i18n/locales/ja/chat.json b/webview-ui/src/i18n/locales/ja/chat.json index 0b963e0a8b0..80549dc5ef7 100644 --- a/webview-ui/src/i18n/locales/ja/chat.json +++ b/webview-ui/src/i18n/locales/ja/chat.json @@ -10,7 +10,8 @@ "contextWindow": "コンテキストウィンドウ:", "closeAndStart": "タスクを閉じて新しいタスクを開始", "export": "タスク履歴をエクスポート", - "delete": "タスクを削除(Shift + クリックで確認をスキップ)" + "delete": "タスクを削除(Shift + クリックで確認をスキップ)", + "condenseContext": "タスクコンテキストを圧縮" }, "unpin": "ピン留めを解除", "pin": "ピン留め", From ec01149495813a1bc9d3a7bdf77cf0a6e644bbc7 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 12:54:51 -0700 Subject: [PATCH 20/21] fix check-types --- webview-ui/src/__tests__/ContextWindowProgress.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webview-ui/src/__tests__/ContextWindowProgress.test.tsx b/webview-ui/src/__tests__/ContextWindowProgress.test.tsx index 3e8373842a2..15c6f4be200 100644 --- a/webview-ui/src/__tests__/ContextWindowProgress.test.tsx +++ b/webview-ui/src/__tests__/ContextWindowProgress.test.tsx @@ -56,6 +56,8 @@ describe("ContextWindowProgress", () => { totalCost: 0.001, contextTokens: 1000, onClose: jest.fn(), + buttonsDisabled: false, + handleCondenseContext: jest.fn((_taskId: string) => {}), } return render( From fd881726d9646f138267c17e0b8f664b99f6ae06 Mon Sep 17 00:00:00 2001 From: Canyon Robins Date: Tue, 20 May 2025 13:42:25 -0700 Subject: [PATCH 21/21] throw --- src/core/webview/ClineProvider.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 62a7c5289e9..22c03922f2a 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1119,8 +1119,7 @@ export class ClineProvider extends EventEmitter implements } } if (!task) { - const { historyItem } = await this.getTaskWithId(taskId) - task = await this.initClineWithHistoryItem(historyItem) + throw new Error(`Task with id ${taskId} not found in stack`) } await task.condenseContext() await this.postMessageToWebview({ type: "condenseTaskContextResponse", text: taskId })