From 9df45fb21634aaee7bacba62995533a5a0269fef Mon Sep 17 00:00:00 2001 From: Frostbourne Date: Fri, 28 Feb 2025 12:00:32 -0800 Subject: [PATCH 1/3] Update PRIVACY.md Fix typo --- docs/PRIVACY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md index c7f9cf01cf..06b43ef197 100644 --- a/docs/PRIVACY.md +++ b/docs/PRIVACY.md @@ -1,3 +1,3 @@ -View our provacy policy on our website. +View our Privacy Policy on our website. (Privacy Policy)[https://cline.bot/privacy] From c1d589f6be94439157f56284555cb5ce28882292 Mon Sep 17 00:00:00 2001 From: Dennis Bartlett Date: Fri, 28 Feb 2025 12:15:25 -0800 Subject: [PATCH 2/3] Feature/privacy policy (#2015) * Update URL syntax --- docs/PRIVACY.md | 2 +- docs/TERMS_OF_SERVICE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md index 06b43ef197..6469a1db61 100644 --- a/docs/PRIVACY.md +++ b/docs/PRIVACY.md @@ -1,3 +1,3 @@ View our Privacy Policy on our website. -(Privacy Policy)[https://cline.bot/privacy] +[Privacy Policy](https://cline.bot/privacy) diff --git a/docs/TERMS_OF_SERVICE.md b/docs/TERMS_OF_SERVICE.md index 0ec7f78067..c8ebaf75a6 100644 --- a/docs/TERMS_OF_SERVICE.md +++ b/docs/TERMS_OF_SERVICE.md @@ -1,3 +1,3 @@ View our Terms of Service on our website. -(Terms of Service)[https://cline.bot/tos] +[Terms of Service](https://cline.bot/tos) From eedae086a30ede10dc01b8334e880b344826f0b5 Mon Sep 17 00:00:00 2001 From: Evan <58194240+celestial-vault@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:12:40 -0800 Subject: [PATCH 3/3] Fix Merge Conflict resolutions Fixes Merge conflict resolutions from Main to Dev that were incorrectly chosen. --- .changeset/silver-hotels-reflect.md | 5 +++++ package-lock.json | 9 +++++---- package.json | 5 +++-- src/api/transform/gemini-format.ts | 15 ++++----------- src/api/transform/o1-format.ts | 3 +++ src/api/transform/openai-format.ts | 3 +++ src/api/transform/vscode-lm-format.ts | 3 +++ src/core/Cline.ts | 4 +--- src/integrations/misc/export-markdown.ts | 16 ++++++++++++---- 9 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 .changeset/silver-hotels-reflect.md diff --git a/.changeset/silver-hotels-reflect.md b/.changeset/silver-hotels-reflect.md new file mode 100644 index 0000000000..b9b6143060 --- /dev/null +++ b/.changeset/silver-hotels-reflect.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Update anthropic SDK to the latest version diff --git a/package-lock.json b/package-lock.json index 6d18ac81a1..4e299ca113 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,9 @@ "license": "Apache-2.0", "dependencies": { "@anthropic-ai/bedrock-sdk": "^0.12.4", - "@anthropic-ai/sdk": "^0.36.3", + "@anthropic-ai/sdk": "^0.37.0", "@anthropic-ai/vertex-sdk": "^0.6.4", + "@google/generative-ai": "^0.18.0", "@mistralai/mistralai": "^1.5.0", "@modelcontextprotocol/sdk": "^1.0.1", "@types/clone-deep": "^4.0.4", @@ -96,9 +97,9 @@ } }, "node_modules/@anthropic-ai/sdk": { - "version": "0.36.3", - "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.36.3.tgz", - "integrity": "sha512-+c0mMLxL/17yFZ4P5+U6bTWiCSFZUKJddrv01ud2aFBWnTPLdRncYV76D3q1tqfnL7aCnhRtykFnoCFzvr4U3Q==", + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.37.0.tgz", + "integrity": "sha512-tHjX2YbkUBwEgg0JZU3EFSSAQPoK4qQR/NFYa8Vtzd5UAyXzZksCw2In69Rml4R/TyHPBfRYaLK35XiOe33pjw==", "license": "MIT", "dependencies": { "@types/node": "^18.11.18", diff --git a/package.json b/package.json index 52bfeb290d..1342e53e0e 100644 --- a/package.json +++ b/package.json @@ -262,9 +262,10 @@ "typescript": "^5.4.5" }, "dependencies": { - "@anthropic-ai/vertex-sdk": "^0.6.4", "@anthropic-ai/bedrock-sdk": "^0.12.4", - "@anthropic-ai/sdk": "^0.36.3", + "@anthropic-ai/sdk": "^0.37.0", + "@anthropic-ai/vertex-sdk": "^0.6.4", + "@google/generative-ai": "^0.18.0", "@mistralai/mistralai": "^1.5.0", "@modelcontextprotocol/sdk": "^1.0.1", "@types/clone-deep": "^4.0.4", diff --git a/src/api/transform/gemini-format.ts b/src/api/transform/gemini-format.ts index 0a783dc183..ca21a4d326 100644 --- a/src/api/transform/gemini-format.ts +++ b/src/api/transform/gemini-format.ts @@ -11,16 +11,7 @@ import { TextPart, } from "@google/generative-ai" -export function convertAnthropicContentToGemini( - content: - | string - | Array< - | Anthropic.Messages.TextBlockParam - | Anthropic.Messages.ImageBlockParam - | Anthropic.Messages.ToolUseBlockParam - | Anthropic.Messages.ToolResultBlockParam - >, -): Part[] { +export function convertAnthropicContentToGemini(content: string | Anthropic.ContentBlockParam[]): Part[] { if (typeof content === "string") { return [{ text: content } as TextPart] } @@ -133,7 +124,7 @@ export function convertGeminiResponseToAnthropic(response: EnhancedGenerateConte // Add the main text response const text = response.text() if (text) { - content.push({ type: "text", text }) + content.push({ type: "text", text, citations: null }) } // Add function calls as tool_use blocks @@ -183,6 +174,8 @@ export function convertGeminiResponseToAnthropic(response: EnhancedGenerateConte usage: { input_tokens: response.usageMetadata?.promptTokenCount ?? 0, output_tokens: response.usageMetadata?.candidatesTokenCount ?? 0, + cache_creation_input_tokens: null, + cache_read_input_tokens: null, }, } } diff --git a/src/api/transform/o1-format.ts b/src/api/transform/o1-format.ts index b7577cf903..237663cd06 100644 --- a/src/api/transform/o1-format.ts +++ b/src/api/transform/o1-format.ts @@ -376,6 +376,7 @@ export function convertO1ResponseToAnthropicMessage( { type: "text", text: normalText, + citations: null, }, ], model: completion.model, @@ -396,6 +397,8 @@ export function convertO1ResponseToAnthropicMessage( usage: { input_tokens: completion.usage?.prompt_tokens || 0, output_tokens: completion.usage?.completion_tokens || 0, + cache_creation_input_tokens: null, + cache_read_input_tokens: null, }, } diff --git a/src/api/transform/openai-format.ts b/src/api/transform/openai-format.ts index 0b134ad4ac..ddcffc8f76 100644 --- a/src/api/transform/openai-format.ts +++ b/src/api/transform/openai-format.ts @@ -161,6 +161,7 @@ export function convertToAnthropicMessage(completion: OpenAI.Chat.Completions.Ch { type: "text", text: openAiMessage.content || "", + citations: null, }, ], model: completion.model, @@ -181,6 +182,8 @@ export function convertToAnthropicMessage(completion: OpenAI.Chat.Completions.Ch usage: { input_tokens: completion.usage?.prompt_tokens || 0, output_tokens: completion.usage?.completion_tokens || 0, + cache_creation_input_tokens: null, + cache_read_input_tokens: null, }, } diff --git a/src/api/transform/vscode-lm-format.ts b/src/api/transform/vscode-lm-format.ts index acec3656e1..04d7245bec 100644 --- a/src/api/transform/vscode-lm-format.ts +++ b/src/api/transform/vscode-lm-format.ts @@ -175,6 +175,7 @@ export async function convertToAnthropicMessage( return { type: "text", text: part.value, + citations: null, } } @@ -195,6 +196,8 @@ export async function convertToAnthropicMessage( usage: { input_tokens: 0, output_tokens: 0, + cache_creation_input_tokens: null, + cache_read_input_tokens: null, }, } } diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 2ce1e9747b..0fbc3faeac 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -65,9 +65,7 @@ import { telemetryService } from "../services/telemetry/TelemetryService" const cwd = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? path.join(os.homedir(), "Desktop") // may or may not exist but fs checking existence would immediately ask for permission which would be bad UX, need to come up with a better solution type ToolResponse = string | Array -type UserContent = Array< - Anthropic.TextBlockParam | Anthropic.ImageBlockParam | Anthropic.ToolUseBlockParam | Anthropic.ToolResultBlockParam -> +type UserContent = Array export class Cline { readonly taskId: string diff --git a/src/integrations/misc/export-markdown.ts b/src/integrations/misc/export-markdown.ts index 76e95e36b7..f130b3043d 100644 --- a/src/integrations/misc/export-markdown.ts +++ b/src/integrations/misc/export-markdown.ts @@ -35,14 +35,20 @@ export async function downloadTask(dateTs: number, conversationHistory: Anthropi }) if (saveUri) { - // Write content to the selected location - await vscode.workspace.fs.writeFile(saveUri, Buffer.from(markdownContent)) - vscode.window.showTextDocument(saveUri, { preview: true }) + try { + // Write content to the selected location + await vscode.workspace.fs.writeFile(saveUri, new TextEncoder().encode(markdownContent)) + vscode.window.showTextDocument(saveUri, { preview: true }) + } catch (error) { + vscode.window.showErrorMessage( + `Failed to save markdown file: ${error instanceof Error ? error.message : String(error)}`, + ) + } } } export function formatContentBlockToMarkdown( - block: Anthropic.TextBlockParam | Anthropic.ImageBlockParam | Anthropic.ToolUseBlockParam | Anthropic.ToolResultBlockParam, + block: Anthropic.ContentBlockParam, // messages: Anthropic.MessageParam[] ): string { switch (block.type) { @@ -50,6 +56,8 @@ export function formatContentBlockToMarkdown( return block.text case "image": return `[Image]` + case "document": + return `[Document]` case "tool_use": let input: string if (typeof block.input === "object" && block.input !== null) {