Compare commits

...

40 Commits

Author SHA1 Message Date
Saoud Rizwan 07feb7f031 Create sour-lies-hear.md 2025-05-22 19:29:26 -07:00
Saoud Rizwan 55b34fa2dc Update package version 2025-05-22 19:28:45 -07:00
Sarah Fortune 2cedcc5a58 Add vscode CSS properties to the script get-vscode-usages.sh (#3752)
The script will report which vscode CSS vars are being used in the webview, as well the uses of the vscode SDK.
2025-05-22 16:18:08 -07:00
limitx0 14a0c60550 Fix the Syntax in zh-tw/README.md to Improve Text Rendering (#3724)
* Update zh-tw/README.md

Correct the Markdown syntax to properly display bold text.

* Update zh-tw/README.md

Insert line breaks for each item listed under ### 新增上下文.
2025-05-22 15:53:15 -07:00
github-actions[bot] cdf368c21c v3.17.2 Release Notes
v3.17.2 Release Notes
2025-05-22 15:43:07 -07:00
Toshii f3ae1340cf global workflows (#3709)
* backend global workflows

* base

* nit

* protos

* base 2

* ui

* Delete proto file

* changeset
2025-05-22 15:34:51 -07:00
David Nanyan 624fb8c8a1 [ISSUE-3707] Fix issue with process env (#3741)
* [ISSUE-3707] Fix issue with process env

* Add tests
2025-05-22 15:33:05 -07:00
Evan dbb5ac265d Claude 4 rest of updates (#3749)
* add protos files (#3736)

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>

* change package script

* rest of updates for vertex / bedrock

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 15:20:54 -07:00
pashpashpash 1fd137b684 z-index-fix on settings page (#3748)
Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-22 15:20:54 -07:00
github-actions[bot] a718cc950e v3.17.1 Release Notes
v3.17.1 Release Notes
2025-05-22 15:20:26 -07:00
Evan cea93d9e98 Update package script (#3738)
* add protos files (#3736)

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>

* change package script

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 12:56:27 -07:00
Evan 346c1f7eff Opus 4 max tokens (#3735)
* anthropic opus max tokens increased

* changeset

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 12:47:23 -07:00
Evan 32f200e837 Prompt caching Claude 4 Openrouter/Cline (#3722)
* add prompt caching and suggested models

* wording

* change wording again

* remove opus recommended

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 12:44:33 -07:00
Evan 07a2daa827 Put protos back in gitignore (#3739)
* put protos back in gitignore

* changeset

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-23 00:33:21 +05:30
github-actions[bot] a22fc10a72 v3.17.0 Release Notes
v3.17.0 Release Notes
2025-05-22 11:02:17 -07:00
Evan 0c306121aa Migrate didShowAnnouncement protobus (#3699)
* migrate didShowAnnouncement

* changeset

* remove comment

* make variable public

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 10:36:31 -07:00
pashpashpash 97139f713b settings cancel (#3734)
* settings cancel

* settings cancel

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-22 10:04:19 -07:00
Tomás Barreiro 77a877c6d3 fix: Replace the togglePlanActMode call with protobuf (#3730)
* Add togglePlanActMode to the WebviewMessage type

* replace the service call with a protobus client call
2025-05-22 09:56:43 -07:00
Evan 627590ff2a anthropic support (#3733)
Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 09:56:32 -07:00
Evan 6835870dee Model 4 UI prep (#3721)
* ui copy changes sonnet 4

* changeset

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-22 20:40:03 +04:00
Daniel Trugman a48c37ee82 Fix requesty list models and usage (#3630)
* Fix requesty list models

* Fix requesty usage
2025-05-22 08:25:02 -07:00
canvrno 579b1f1968 [PROTOBUS] Move togglePlanActMode to protobus (fixed) (#3686)
* togglePlanActMode protobus migration

* metadata on request

* cleanup

* snake case in protos

* merge conflcits + removed metadata for consistency
2025-05-22 02:11:12 -07:00
Adil Riazudeen 331da0f802 fix: revert ServerConfigSchema to union. (#3716)
This type was changed from a union to a discriminated union based on
transportType. It seems like this is an internal implementation detail
that end users shouldn't really care about. This change reverts that
type back to a union.

Co-authored-by: Adil Riazudeen <adiriazu@amazon.com>
2025-05-22 01:25:32 -07:00
canvrno 782ed7ff21 [PROTOBUS] Move autoApprovalSettings to protobus (#3423)
* autoApprovalSettings protobus migration

* fixed merge conflict mistake
2025-05-21 23:56:38 -07:00
pashpashpash c511b91a09 New settings page, inspired by Yellow Bat and Roo <3 (#3720)
* new settings view tabs

* making sure things scroll

* tidying up

* changeset

* py

* bringing back mcp settings button

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-21 23:46:24 -07:00
Ara efb6ae1529 Changing Title wording for cline extension (#3712)
Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-22 10:37:16 +04:00
Toshii 58f80d4d16 NO MORE PROTO (#3715)
* delete ui proto

* changeset
2025-05-21 20:24:50 -07:00
Ara c3b556ddce Remove Advanced settings banner from MCP (#3713)
* Remove MCP Settings banner

* Remove Advnaced Settings banner

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-21 19:38:16 -07:00
wangyijing130 f16120fbfc fix the display from filename if type is windows (#3554)
Co-authored-by: wangyj20 <wangyj20@asiainfo.com>
2025-05-21 19:13:01 -07:00
pashpashpash 02002860ca when the assistant says to act mode we render a custom highlight with hotkey suggestion (#3708)
* when the assistant says to act mode we render a custom highlight with hotkey suggestion

* changeset

* console

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-21 18:11:17 -07:00
Akim Tsvigun b97e57fd4e Integration with Nebius AI Studio (#2789)
* Integration with Nebius AI Studio added

* changeset added

* tests fixed

* Nebius naming changed

* bugs fixed

* styling fixed

* minor bug fixed

* Remove obsolete ClineProvider.ts file that was causing build errors

* redundant 'Model' section removed for Nebius

* feat: add Nebius AI Studio to the list of inference providers (#2789)

- replace `nebiusModelId` to `apiModelId`
- add our latest models
- fix `getModel` method
- fix spaces and the link to Nebius AI Studio api keys
- delete extra code
- add a couple of tests

---------

Co-authored-by: Akim Tsvigun <aktsvigun@nebius.com>
Co-authored-by: Albert Abdulmanov <albertworks@nebius.com>
2025-05-22 05:10:44 +05:30
Andrei Eternal cd927ae279 gitignore protobuf generated files & git rm (#3661) 2025-05-21 14:39:46 -07:00
github-actions[bot] e2da226c10 v3.16.3 Release Notes
v3.16.3 Release Notes
2025-05-21 13:26:45 -07:00
Ara eae28f1cee Fixing Typescript type errors in MCP hub (#3700)
* Fixing Typescript type errors in MCP hub

* Fixing Typescript type errors in MCP hub

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-21 13:11:35 -07:00
pashpashpash 47eacdc545 Pashpashpash/rules links (#3701)
* adding docs links to rules modal

* changeset

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-21 13:11:28 -07:00
Tomás Barreiro b669dfbc7e feat: Add devstrall-small-2505 to the Mistral model list (#3697)
* Add devstrall-small-2505 to the Mistral model list

* update context information and set as default
2025-05-22 01:23:35 +05:30
Tomás Barreiro 9f192768bc fix: handle mistral sdk api errors (#3698) 2025-05-22 01:20:39 +05:30
Alejandro Peral Taboada 8356e058c1 feat: support streameable http transport (#3413)
* feat: support Stremeable Http transport

* feat: add http to rpc method
2025-05-21 10:17:26 -07:00
pashpashpash 0870c65fa5 moar docs (#3689)
* title

* crosslinking and commands

* better

* fixing

* fixing inaccuracies

* language

* images

---------

Co-authored-by: Cline Evaluation <cline@example.com>
2025-05-21 00:59:25 -07:00
Evan 36c0192bd2 Migrate refreshClineRules protobus (#3690)
* migrate refreshClineRules

* changeset

---------

Co-authored-by: Elephant Lumps <celestial_vault@Elephants-MacBook-Pro.local>
2025-05-20 22:58:34 -07:00
102 changed files with 3648 additions and 810 deletions
-5
View File
@@ -1,5 +0,0 @@
---
"claude-dev": minor
---
Migrate openSettings message to use state navigation handlers
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Update package version
+8
View File
@@ -20,3 +20,11 @@ coverage
!.github/scripts/coverage/
*evals.env
# Generated proto files
src/shared/proto/*.ts
src/core/controller/*/methods.ts
src/core/controller/*/index.ts
src/core/controller/grpc-service-config.ts
webview-ui/src/services/grpc-client.ts
src/standalone/server-setup.ts
+29
View File
@@ -1,5 +1,34 @@
# Changelog
## [3.17.2]
- Add support for Claude 4 models (Sonnet 4 and Opus 4) in AWS Bedrock and Vertex AI providers
- Add support for global workflows, allowing workflows to be shared across workspaces with local workflows taking precedence
- Fix settings page z-index UI issues that caused display problems
- Fix AWS Bedrock environment variable handling to properly restore process.env after API calls (Thanks @DaveFres!)
## [3.17.1]
- Add prompt caching for Claude 4 models on Cline and OpenRouter providers
- Increase max tokens for Claude Opus 4 from 4096 to 8192
## [3.17.0]
- Add support for Anthropic Claude Sonnet 4 and Claude Opus 4 in both Anthropic and Vertex providers
- Add integration with Nebius AI Studio as a new provider (Thanks @Aktsvigun!)
- Add custom highlight and hotkey suggestion when the assistant prompts to switch to Act mode
- Update settings page design, now split into tabs for easier navigation (Thanks Yellow Bat @dlab-anton, and Roo Team!)
- Fix MCP Server configuration bug
- Fix model listing for Requesty provider
- Move all advanced settings to settings page
## [3.16.3]
- Add devstral-small-2505 to the Mistral model list, a new specialized coding model from Mistral AI (Thanks @BarreiroT!)
- Add documentation links to rules & workflows UI
- Add support for Streameable HTTP Transport for MCPs (Thanks @alejandropta!)
- Improve error handling for Mistral SDK API
## [3.16.2]
- Add support for Gemini 2.5 Flash Preview 05-20 model to Vertex AI provider with massive 1M token context window (Thanks @omercelik!)
+25 -13
View File
@@ -74,18 +74,13 @@
{
"group": "Features",
"pages": [
"features/plan-and-act",
"features/auto-approve",
"features/checkpoints",
"features/cline-rules",
"features/drag-and-drop",
"features/plan-and-act",
"features/slash-commands/workflows",
{
"group": "Slash Commands",
"pages": [
"features/slash-commands/new-task",
"features/slash-commands/new-rule",
"features/slash-commands/smol",
"features/slash-commands/report-bug"
]
},
"features/editing-messages",
{
"group": "@ Mentions",
"pages": [
@@ -96,6 +91,25 @@
"features/at-mentions/git-mentions",
"features/at-mentions/url-mentions"
]
},
{
"group": "Slash Commands",
"pages": [
"features/slash-commands/new-task",
"features/slash-commands/new-rule",
"features/slash-commands/smol",
"features/slash-commands/report-bug"
]
},
{
"group": "Commands & Shortcuts",
"pages": [
"features/commands-and-shortcuts/overview",
"features/commands-and-shortcuts/code-commands",
"features/commands-and-shortcuts/terminal-integration",
"features/commands-and-shortcuts/git-integration",
"features/commands-and-shortcuts/keyboard-shortcuts"
]
}
]
},
@@ -103,10 +117,8 @@
"group": "Exploring Cline's Tools",
"pages": [
"exploring-clines-tools/cline-tools-guide",
"exploring-clines-tools/checkpoints",
"exploring-clines-tools/new-task-tool",
"exploring-clines-tools/remote-browser-support",
"exploring-clines-tools/slash-commands"
"exploring-clines-tools/remote-browser-support"
]
},
{
-114
View File
@@ -1,114 +0,0 @@
---
title: "Checkpoints and Messages"
description: "When working with AI coding assistants, it's easy to lose control as they make rapid changes to your codebase. That's why we built Checkpoints - your safety net for experimenting confidently."
---
Checkpoints automatically save snapshots of your workspace after each step in a task. This powerful feature lets you:
- Track and review changes made during a task
- Roll back to any previous point if needed
- Experiment confidently with auto-approve mode
- Maintain full control over your workspace
### ⚙️ How Checkpoints Work
Cline creates a checkpoint after each tool use (file edits, commands, etc.). These checkpoints:
- Work alongside your Git workflow without interference
- Maintain context between restores
- Use a shadow Git repository to track changes
For example, if you're working on a feature and Cline makes multiple file changes, each change creates a checkpoint. This means you can review each modification and, if needed, roll back to any point without affecting your main Git repository.
#### Viewing Changes & Restoring to Checkpoint
After each tool use, you can:
1. Click the "Compare" button to see modified files
2. Click the "Restore" button to open restore options
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/image%20(13).png"
alt="Checkpoint comparison and restore options"
/>
</Frame>
#### Rolling Back
To restore to a previous point:
1. Click the "Restore" button next to any step
2. Choose from three options:
- **Restore Task and Workspace**: Reset both codebase and task to that point
- **Restore Task Only**: Keep codebase changes but revert task context
- **Restore Workspace Only**: Reset codebase while preserving task context
Example: If Cline makes changes you don't like while styling a component, you can use "Restore Workspace Only" to revert the code changes while keeping the conversation context, allowing you to try a different approach.
### 💡 Use Cases
Checkpoints let you be more experimental with Cline. While human coding is often methodical and iterative, AI can make substantial changes quickly. Checkpoints help you track these changes and revert if needed.
#### 1. Using Auto-Approve Mode
- Provides safety net for rapid iterations
- Makes it easy to undo unexpected results
#### 2. Testing Different Approaches
- Try multiple solutions confidently
- Compare different implementations
- Quickly revert to working states
- Ideal for exploring different design patterns or architectural approaches
<Frame caption="In this case, I didn't like the changes Cline made to my robot dog-walking website (still working on the robots) and I wanted to revert both the codebase and the task to before any changes were made so I could start fresh.">
<img src="https://storage.googleapis.com/cline_public_images/docs/assets/checkpointsDemo.gif" alt="Checkpoint restore demo" />
</Frame>
### ✨ Best Practices
1. Use checkpoints as safety nets when experimenting
2. Leverage auto-approve mode more confidently, knowing you can always roll back
3. Restore selectively based on needs:
- Use "Restore Task and Workspace" for a fresh start, reversing changes to files and the task conversation.
- Use "Restore Task Only" to try different prompts, but leave all files as they exist
- Use "Restore Workspace Only" to attempt different implementations, or prune context from the task
🛟 Checkpoints are your safety net when working with Cline, enabling you to experiment freely while maintaining full control over your codebase. Whether you're refactoring a complex component, trying different implementation approaches, or using auto-approve mode for rapid development, checkpoints ensure you can always review changes and roll back if needed.
#### 🗑️ Deleting Checkpoints
You can delete all checkpoints by using the **"Delete All History"** button in the task history menu. Note that this will also delete all tasks. Checkpoints are stored in VS Code's globalStorage.
---
## Editing Messages
Cline allows you to edit chat messages in a task after they've been submitted (with the exception of the message that started the task).
Perhaps you didn't get the results you wanted, thought of a better way to phrase your request, or need to add more information. Editing your message allows you to re-submit a request without starting over or restoring your files or workspace with checkpoints. There are two Restore options:
- **"Restore Chat"** restores just the task state and re-submits an API request to your provider with your edited message.
- **"Restore All"** restores both the task state and workspace state before re-submitting an API request. "Workspace state" refers to the condition of your workspace (files, content, etc.) at different points in the conversation.
**Interactive Editing:**
- Messages can be clicked to enter edit mode
- Cline automatically selects all text when entering edit mode
**Keyboard Shortcuts:**
- Escape: Exit edit mode
- Enter: Restore just the task
- Cmd/Ctrl + Enter: Restore the task and workspace
- Shift + Enter: Insert new line / line break
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/message-editing.png"
alt="Message editing interface"
/>
</Frame>
@@ -29,6 +29,11 @@ As a quick alternative to Cline suggesting the `newtask` tool or defining comple
- **Action:** Cline will propose creating a new task, typically suggesting context based on the current session (similar to its default behavior when using the tool). You will still get the `ask_followup_question` prompt to confirm and potentially modify the context before the new task is created.
- **Benefit:** Provides a fast, user-initiated way to leverage the `new_task` functionality for branching explorations or managing long sessions without waiting for Cline to suggest it.
<Note>
For more details on using the `/newtask` slash command, see the [New Task Command](/features/slash-commands/new-task)
documentation.
</Note>
#### Default Behavior (Without `.clinerules`)
By default, without specific `.clinerules` dictating its behavior:
@@ -1,57 +0,0 @@
---
title: "Slash Commands"
---
#### Overview
Cline provides slash commands as a quick way to invoke specific tools or actions directly from the chat input, offering shortcuts for common operations. This page details the available slash commands and their usage.
#### /newtask
The `/newtask` slash command provides a fast, user-initiated way to leverage the `new_task` tool's functionality for branching explorations or managing long sessions without waiting for Cline to suggest it.
**Functionality:**
1. **Initiation:** Typing `/newtask` in the chat input signals Cline to prepare for starting a new task session.
2. **Context Proposal:** Cline proposes creating a new task and typically suggests context to preload based on the current session (summarizing key aspects like current work, technical concepts, relevant files, problems solved, and next steps).
3. **User Confirmation:** You will receive a confirmation prompt (via the `ask_followup_question` tool) displaying the proposed context. You can approve it directly or modify the context before the new task begins.
4. **New Session:** Upon confirmation, Cline ends the current task session and immediately starts a new one, preloaded with the approved context.
**Benefit:** Allows you to cleanly branch your work or start a new phase while carrying over essential background information ("knowledge transfer") without manual copying or losing the thread of the previous session.
#### /smol (alias /compact)
The `/smol` slash command (with `/compact` as an alias) allows you to condense the chat history **within your current task**. This is useful when a conversation becomes very long, potentially impacting performance or making it harder for the model to maintain focus.
**Functionality:**
1. **Initiation:** Typing `/smol` or `/compact` tells Cline you want to condense the current chat history. You can optionally add instructions after the command to guide the summarization process (e.g., `/smol focus only on the database changes` or `/smol be concise, use bullet points`).
2. **Summarization:** Cline analyzes the conversation history, considering any additional instructions provided, and generates a summary focusing on key elements: recent discussion points, important decisions, technical concepts, relevant files, problems solved, and planned next steps. Cline determines the appropriate length and detail for the summary. It retains the beginning and very recent parts of the chat while summarizing the middle sections.
3. **User Confirmation:** Cline presents this generated summary to you via a confirmation prompt and asks if it accurately reflects the essential context.
4. **Condensing:** If you approve the summary, Cline replaces the summarized middle portion of the chat history in its active context with the generated summary. This reduces the overall token count for subsequent interactions within the _same task_.
5. **Feedback:** If you reject the summary or provide feedback, Cline will retain the original history and incorporate your feedback for future actions.
**Benefit:** Helps maintain focus and manage token usage during very long, continuous tasks (like deep debugging or extended feature development) without needing to start an entirely new task session. Allows user guidance on the summarization focus.
#### When to Use Which?
Choosing between `/newtask` and `/smol` depends on your goal:
- Use `/smol` (or `/compact`) when:
- You want to continue the **same task**, but the chat history has become very long or costly.
- You need to reduce token usage for upcoming interactions within the current workflow.
- Example: Deep debugging session where you want to summarize previous steps before continuing.
- Use `/newtask` when:
- You have finished one phase of work and want to start a **fresh, related task**.
- You want to branch your exploration while preserving key context from the previous session.
- Example: Moving from developing Feature A to starting work on Feature B, carrying over relevant architectural decisions.
#### Why Manage Context?
While Cline supports large context windows, actively managing context using tools and commands like `/newtask` and `/smol` is often beneficial:
- **Performance:** Large language models can sometimes experience performance degradation or lose focus when context windows become extremely full (e.g., over 50-75% capacity, depending on the model). Condensing or resetting context can help maintain optimal performance.
- **Relevance:** Summarizing or starting fresh ensures the most relevant information is prioritized in the context window.
- **Cost:** Reducing the number of tokens sent to the model in each turn can help manage costs, especially with more expensive models.
Using `/newtask` and `/smol` provides you with direct control over the conversation context, allowing for more efficient and effective interaction with Cline.
+19 -9
View File
@@ -1,5 +1,5 @@
---
title: "@ MentionsOverview"
title: "@ Mentions Overview"
sidebarTitle: "Overview"
---
@@ -15,35 +15,45 @@ When you type `@` in the chat input, Cline shows a menu of available mention typ
Cline supports several types of @ mentions, each designed to bring different kinds of context into your conversations:
<Card title="File Mentions" icon="file" href="/features/at-mentions/file-mentions">
Reference any file in your workspace with `@/path/to/file`. Cline sees the complete file content, including imports, related
functions, and surrounding context.
</Card>
<Columns cols={2}>
<Card title="File Mentions" icon="file" href="/features/at-mentions/file-mentions">
Reference any file in your workspace with `@/path/to/file`. Cline sees the complete file content, including imports, related
functions, and surrounding context.
</Card>
{" "}
<Card title="Folder Mentions" icon="folder" href="/features/at-mentions/folder-mentions">
Reference entire directories with `@/path/to/folder/`. Cline sees the folder structure and all file contents, perfect for
understanding complex interactions between multiple files.
</Card>
{" "}
<Card title="Problem Mentions" icon="triangle-exclamation" href="/features/at-mentions/problem-mentions">
Use `@problems` to show Cline all the errors and warnings in your workspace. Cline sees the complete list with file locations
and error messages.
</Card>
{" "}
<Card title="Terminal Mentions" icon="terminal" href="/features/at-mentions/terminal-mentions">
Use `@terminal` to share your recent terminal output. Cline sees the complete output with formatting preserved, perfect for
debugging build errors or test failures.
</Card>
{" "}
<Card title="Git Mentions" icon="code-branch" href="/features/at-mentions/git-mentions">
Reference uncommitted changes with `@git-changes` or specific commits with `@[commit-hash]`. Cline sees the complete diff,
commit message, and other relevant information.
</Card>
<Card title="URL Mentions" icon="globe" href="/features/at-mentions/url-mentions">
Reference web content with `@https://example.com`. Cline fetches and sees the complete webpage content, perfect for
referencing documentation or GitHub issues.
</Card>
<Card title="URL Mentions" icon="globe" href="/features/at-mentions/url-mentions">
Reference web content with `@https://example.com`. Cline fetches and sees the complete webpage content, perfect for
referencing documentation or GitHub issues.
</Card>
</Columns>
## Why @ Mentions Matter
+59
View File
@@ -0,0 +1,59 @@
The Auto Approve menu lets you set fine-grained permissions on what you allow Cline to do in an automated way.
<Frame>
<img src="https://storage.googleapis.com/cline_public_images/docs/assets/auto-approve.png" alt="Auto Approve" />
</Frame>
## How it works
By default, Cline will ask for your permission before calling any tool, including reading or writing files.
If you want to allow Cline to do something without asking, you can set the Auto Approve permission for that tool.
## Permission Options
- **Read project files**
- Allows Cline to read files within your current workspace without asking
- **Read all files**
- Extends read permission to files outside your workspace (system files, config files, etc.)
- **Edit project files**
- Allows Cline to modify files within your current workspace without confirmation
- **Edit all files**
- Extends modification permission to files outside your workspace
- **Execute safe commands**
- Allows execution of terminal commands that the model deems non-destructive
- **Execute all commands**
- Permits execution of any terminal command without asking
- **Use the browser**
- Allows Cline to use the browser tool to fetch web content
- **Use MCP servers**
- Permits connection to and usage of MCP servers for extended functionality
- **Maximum requests**
- Sets the number of consecutive automated actions Cline can take before requiring your input
## Best Practices
Personally, I like to keep auto-editing disabled because it gives me a chance to review changes every step of the way.
For most serious development workflows, I recommend starting with:
- Auto-approving read access to project files
- Setting a reasonable maximum request limit (10-20)
This gives Cline enough freedom to explore your codebase without constant interruptions, while still requiring permission for edits or potentially destructive actions.
As you build more trust in Cline's capabilities with your specific projects, you can gradually increase the permissions to match your comfort level.
Remember that you can always adjust these settings as your needs change - tighten permissions for critical production work, or loosen them when prototyping and exploring.
You can even use the quick "star" actions to quickly toggle your auto-approved selections on and off as you go.
+79
View File
@@ -0,0 +1,79 @@
---
title: "Checkpoints"
sidebarTitle: "Checkpoints"
---
Checkpoints automatically save snapshots of your workspace after each step in a task. This feature lets you track changes, roll back when needed, and experiment confidently with your code.
## How Checkpoints Work
Cline creates a checkpoint after each tool use (file edits, commands, etc.). These checkpoints:
- Work alongside your Git workflow without interference
- Maintain context between restores
- Use a shadow Git repository to track changes
For example, if you're working on a feature and Cline makes multiple file changes, each change creates a checkpoint. This means you can review each modification and, if needed, roll back to any point without affecting your main Git repository.
## Viewing Changes & Restoring
After each tool use, you can:
1. Click the "Compare" button to see modified files
2. Click the "Restore" button to open restore options
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/image%20(13).png"
alt="Checkpoint comparison and restore options"
/>
</Frame>
## Restore Options
To restore to a previous point:
1. Click the "Restore" button next to any step
2. Choose from three options:
- **Restore Task and Workspace**: Reset both codebase and task to that point
- **Restore Task Only**: Keep codebase changes but revert task context
- **Restore Workspace Only**: Reset codebase while preserving task context
Example: If Cline makes changes you don't like while styling a component, you can use "Restore Workspace Only" to revert the code changes while keeping the conversation context, allowing you to try a different approach.
<Frame caption="Reverting both codebase and task to before any changes were made to start fresh">
<img src="https://storage.googleapis.com/cline_public_images/docs/assets/checkpointsDemo.gif" alt="Checkpoint restore demo" />
</Frame>
## Use Cases
Checkpoints let you be more experimental with Cline. While human coding is often methodical and iterative, AI can make substantial changes quickly. Checkpoints help you track these changes and revert if needed.
### Using Auto-Approve Mode
- Provides safety net for rapid iterations
- Makes it easy to undo unexpected results
### Testing Different Approaches
- Try multiple solutions confidently
- Compare different implementations
- Quickly revert to working states
- Ideal for exploring different design patterns or architectural approaches
## Best Practices
1. Use checkpoints as safety nets when experimenting
2. Leverage auto-approve mode more confidently, knowing you can always roll back
3. Restore selectively based on needs:
- Use "Restore Task and Workspace" for a fresh start
- Use "Restore Task Only" to try different prompts, but keep file changes
- Use "Restore Workspace Only" to attempt different implementations while preserving conversation context
## Relationship with Message Editing
The [message editing feature](/features/editing-messages) uses checkpoints under the hood when you select the "Restore All" option. This allows you to not only edit and resubmit your message but also restore your workspace to the state it was in at that point in the conversation.
## Deleting Checkpoints
You can delete all checkpoints by using the **"Delete All History"** button in the task history menu. Note that this will also delete all tasks. Checkpoints are stored in VS Code's globalStorage.
@@ -0,0 +1,129 @@
---
title: "Code Commands"
sidebarTitle: "Code Commands"
---
Cline's code commands bring AI assistance directly into your editor, letting you interact with your code without leaving your workflow. With a simple right-click, you can add code to Cline, and through the lightbulb menu, you can fix errors, get explanations, or improve your code.
## Available Code Commands
When you interact with code in your editor, you can access Cline commands in two ways:
### Right-Click Context Menu
When you right-click on selected code, you'll see:
<Frame>
<img src="https://storage.googleapis.com/cline_public_images/docs/assets/code-commands.png" alt="Right Click Menu" />
</Frame>
#### Add to Cline
The "Add to Cline" command sends your selected code to the Cline chat panel. This is perfect for:
- Asking questions about specific code snippets
- Requesting improvements or optimizations
- Getting explanations of complex logic
When you use this command, Cline automatically includes:
- The file path (as a file mention)
- The selected code with proper formatting
- The programming language for accurate syntax highlighting
### Lightbulb Menu (Code Actions)
When you see a lightbulb icon in your editor, click it to access these Cline commands:
<Frame>
<img src="https://storage.googleapis.com/cline_public_images/docs/assets/lightbulb-actions.png" alt="Lightbulb Menu" />
</Frame>
#### Fix with Cline
The "Fix with Cline" command appears in the lightbulb menu when your code has errors or warnings. This command:
1. Captures the selected code
2. Identifies the errors or warnings from VSCode's diagnostics
3. Sends both to Cline with a request to fix the issues
4. Provides a solution that addresses the specific problems
This is incredibly useful for quickly resolving syntax errors, linter warnings, or type issues without having to manually describe the problem.
#### Explain with Cline
The "Explain with Cline" command helps you understand complex code. When you select code and use this command from the lightbulb menu, Cline:
1. Analyzes the selected code
2. Provides a clear explanation of what the code does
3. Breaks down complex logic into understandable parts
4. Highlights important patterns or techniques used
#### Improve with Cline
The "Improve with Cline" command helps you enhance your code. When you select code and use this command from the lightbulb menu, Cline:
1. Analyzes the selected code for potential improvements
2. Suggests optimizations, refactorings, or better practices
3. Explains the reasoning behind the suggested changes
4. Provides improved code that maintains the original functionality
## How to Use Code Commands
Using Cline's code commands is simple:
### For Right-Click Commands:
1. Select the code you want to work with
2. Right-click to open the context menu
3. Choose "Add to Cline"
4. View the result in the Cline chat panel
### For Lightbulb Menu Commands:
1. Select the code you want to work with
2. Look for the lightbulb icon that appears in the editor gutter
3. Click the lightbulb to see available actions
4. Choose the appropriate Cline command (Fix, Explain, or Improve)
5. View the result in the Cline chat panel
After using any command, you can:
- Ask follow-up questions
- Request modifications to the solution
- Apply the changes back to your code
## How It Works Under the Hood
When you use a code command, here's what happens behind the scenes:
1. **Code Selection**: The extension captures your selected code and its context
2. **Metadata Collection**: Cline gathers important metadata:
- File path and name
- Programming language
- Any associated diagnostics (errors/warnings)
- Surrounding code context when relevant
3. **Command Processing**:
- For "Add to Cline," the code is formatted and sent to the chat panel
- For "Fix with Cline," the code and diagnostics are analyzed and a fix is generated
- For "Explain with Cline," the code is analyzed to provide a clear explanation
- For "Improve with Cline," the code is analyzed for potential optimizations and improvements
4. **Integration with Chat**: The results appear in the Cline chat panel, where you can:
- See the AI's response
- Ask follow-up questions
- Apply suggested changes
This seamless integration between your editor and Cline's AI capabilities makes it easy to get assistance without disrupting your coding flow.
## Tips for Effective Use
- **Select complete logical units**: When possible, select entire functions, classes, or modules to give Cline complete context
- **Include imports**: For language-specific help, include relevant imports so Cline understands dependencies
- **Combine with @ mentions**: For complex issues, use code commands along with file or problem mentions for more context
- **Use keyboard shortcuts**: Speed up your workflow by [assigning keyboard shortcuts](/features/commands-and-shortcuts/keyboard-shortcuts) to common code commands
Next time you're struggling with a piece of code, try using Cline's code commands instead of switching to a separate chat interface. You'll be amazed at how much more efficient your workflow becomes when AI assistance is integrated directly into your editor.
@@ -0,0 +1,71 @@
---
title: "Generate Commit Message"
sidebarTitle: "Generate Commit Message"
---
Cline's Git integration brings AI assistance directly to your version control workflow. Generate commit messages without leaving your editor.
## Generate Commit Message
One of the most useful Git integrations is the ability to automatically generate meaningful commit messages:
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/generate-commit-message-with-cline.png"
alt="Generate Commit Message with Cline"
/>
</Frame>
1. Make your changes and stage them in Git
2. Click the robot icon in the Source Control view or run the "Generate Commit Message with Cline" command
3. Cline analyzes your changes and generates a descriptive commit message
4. The message is automatically inserted into the commit message input box
The generated commit messages:
- Start with a concise summary (50-72 characters)
- Use imperative mood (e.g., "Add feature" not "Added feature")
- Describe what was changed and why
- Follow Git best practices
This feature saves time and ensures your commit history is consistent and informative.
<Tip>
For information about using `@git-changes` and `@[commit-hash]` mentions in your chat messages, see the [Git
Mentions](/features/at-mentions/git-mentions) documentation.
</Tip>
## How It Works
When you use Cline's commit message generation feature, here's what happens behind the scenes:
1. Cline retrieves the current Git diff using `getWorkingState()`
2. It formats this diff into a specialized prompt for the AI
3. The AI analyzes the changes and generates an appropriate commit message
4. The message is extracted and inserted into the Git commit message input box
This process uses your current Cline API configuration, so the quality of the generated messages matches your chosen AI model.
## Tips for Effective Use
- **Generate commit messages for complex changes**: The AI excels at summarizing multiple related changes into a coherent message.
- **Review and edit generated messages**: While the AI generates high-quality messages, it's always good practice to review and adjust them if needed.
- **Stage related changes together**: For the best results, stage related changes together so the AI can generate a cohesive message.
- **Use for consistent commit history**: Using the generate commit message feature helps maintain a consistent style across your commit history.
## How It Works Under the Hood
The commit message generation leverages VSCode's Git extension API to access repository information:
1. When you trigger the command:
- Cline gets the current diff
- It sends this to the AI with specific instructions for commit message formatting
- It parses the AI's response
- It accesses the Git extension API to set the commit message
This integration with Git makes it easy to generate high-quality commit messages without disrupting your workflow.
Next time you're struggling to write a good commit message, try using Cline's commit message generation. You'll save time and improve your version control workflow with AI assistance right where you need it.
@@ -0,0 +1,103 @@
---
title: "Keyboard Shortcuts"
sidebarTitle: "Keyboard Shortcuts"
---
Cline's keyboard shortcuts let you access AI assistance without taking your hands off the keyboard. Speed up your workflow by using hotkeys for common Cline actions.
## Default Keyboard Shortcuts
Cline comes with the following built-in keyboard shortcuts to streamline your workflow:
| Action | Windows/Linux | macOS | Condition | Description |
| ----------------------- | ------------- | ------- | ---------------------------- | ----------------------------------------- |
| Add to Cline | `Ctrl+'` | `Cmd+'` | When text is selected | Adds selected code to Cline chat |
| Focus Chat Input | `Ctrl+'` | `Cmd+'` | When no text is selected | Focuses the Cline chat input field |
| Generate Commit Message | (unset) | (unset) | When Git is the SCM provider | Available through the Source Control view |
## Available Commands for Custom Shortcuts
While Cline has only a few default keyboard shortcuts, you can assign your own shortcuts to any of these commands:
| Command ID | Description |
| ---------------------------------------------------------------------------------------- | --------------------------------------------- |
| [`cline.openInNewTab`](/features/commands-and-shortcuts/overview) | Opens Cline in a new editor tab |
| [`cline.addToChat`](/features/commands-and-shortcuts/code-commands) | Adds selected code to Cline chat |
| [`cline.addTerminalOutputToChat`](/features/commands-and-shortcuts/terminal-integration) | Adds terminal output to Cline |
| `cline.focusChatInput` | Focuses the Cline chat input field |
| [`cline.generateGitCommitMessage`](/features/commands-and-shortcuts/git-integration) | Generates a commit message for staged changes |
| [`cline.explainCode`](/features/commands-and-shortcuts/code-commands) | Explains selected code |
| [`cline.improveCode`](/features/commands-and-shortcuts/code-commands) | Suggests improvements for selected code |
| [`cline.fixWithCline`](/features/commands-and-shortcuts/code-commands) | Fixes code with errors |
| `claude-dev.SidebarProvider.focus` | Opens and focuses the Cline sidebar |
## Customizing Keyboard Shortcuts
You can customize Cline's keyboard shortcuts to match your preferences:
1. Open the Keyboard Shortcuts editor in VSCode:
- Press `Ctrl+K Ctrl+S` (Windows/Linux) or `Cmd+K Cmd+S` (macOS)
- Or go to File > Preferences > Keyboard Shortcuts
2. Search for "Cline" to see all available commands
3. Click on the pencil icon next to any command to change its shortcut
4. Press the keys you want to assign to that command
5. Press Enter to save the new shortcut
## Suggested Custom Shortcuts
Here are some suggested shortcuts you might find useful:
| Action | Suggested Shortcut | Command ID | Description |
| --------------------- | ------------------------------ | ----------------------------------------- | ----------------------------- |
| Open Cline Sidebar | `Ctrl+Shift+C` / `Cmd+Shift+C` | `claude-dev.SidebarProvider.focus` | Opens the Cline sidebar panel |
| New Task | `Alt+N` | `cline.plusButtonClicked` | Starts a new Cline task |
| Add Terminal to Cline | `Alt+T` | `cline.addTerminalOutputToChat` | Adds terminal output to Cline |
| Clear Current Task | `Alt+C` | (Requires custom keybinding to UI action) | Clears the current task |
## Keyboard-Only Workflow
With the right shortcuts, you can use Cline without ever touching the mouse:
1. Select code with keyboard navigation (`Shift+Arrow` keys)
2. Send to Cline with `Ctrl+'` / `Cmd+'`
3. Type your question and press Enter
4. Review the response and apply suggestions
## Editor Integration Shortcuts
Cline's keyboard shortcuts integrate seamlessly with VSCode's built-in shortcuts:
- Use VSCode's selection shortcuts (`Ctrl+L` / `Cmd+L` to select line, etc.) before sending code to Cline
- Combine with VSCode's split editor shortcuts to view code and Cline side by side
- Use VSCode's terminal focus shortcut (`` Ctrl+` `` / `` Cmd+` ``) before capturing terminal output
## Tips for Effective Use
- **Learn the default shortcut first**: The `Ctrl+'` / `Cmd+'` shortcut is versatile - it adds selected code to chat when text is selected, or focuses the chat input when nothing is selected
- **Create muscle memory**: Use keyboard shortcuts consistently to build habits
- **Customize for your workflow**: Assign shortcuts to commands you use frequently
- **Consider ergonomics**: Choose shortcuts that are comfortable for your keyboard layout
Keyboard shortcuts may seem like a small optimization, but they can significantly speed up your workflow when using Cline regularly. By keeping your hands on the keyboard, you maintain your coding flow while still getting AI assistance exactly when you need it.
## How to Find All Available Commands
To see all Cline commands that can be assigned shortcuts:
1. Open the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`)
2. Type "Cline" to filter the list
3. Browse the available commands
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/editor-integration.png"
alt="Editor Integration Overview"
/>
</Frame>
This helps you discover features you might not have known about and assign shortcuts to the ones you use most frequently.
@@ -0,0 +1,65 @@
---
title: "Commands & Shortcuts Overview"
sidebarTitle: "Overview"
---
Cline integrates directly into VSCode's interface, letting you access AI assistance without disrupting your workflow. These integrations appear as commands in context menus, keyboard shortcuts, and quick fixes throughout the editor.
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/editor-integration.png"
alt="Editor Integration Overview"
/>
</Frame>
### What are Editor Integrations?
Editor integrations are commands and shortcuts that let you use Cline right where you're working. Instead of switching to the Cline panel first, you can select code, right-click, and immediately send it to Cline for help.
These integrations appear in different places throughout VSCode:
- In the editor context menu (right-click menu) - "Add to Cline"
- In the terminal context menu - "Add to Cline"
- In the Source Control view - "Generate Commit Message"
- As keyboard shortcuts - Various Cline commands
- As Quick Fix options (lightbulb menu) - "Fix with Cline", "Explain with Cline", "Improve with Cline"
### Available Editor Integrations
Cline offers several editor integrations, each designed to enhance different aspects of your development workflow:
<Columns cols={2}>
<Card title="Code Commands" icon="code" href="/features/commands-and-shortcuts/code-commands">
Right-click on code to add it to Cline, or use the lightbulb menu to fix errors, explain code, or improve it. Cline sees the complete code context, including imports and surrounding functions.
</Card>
{" "}
<Card title="Terminal Integration" icon="terminal" href="/features/commands-and-shortcuts/terminal-integration">
Add terminal output to Cline with a right-click or use `@terminal` mentions. Perfect for debugging build errors, test
failures, or runtime issues.
</Card>
{" "}
<Card title="Git Integration" icon="code-branch" href="/features/commands-and-shortcuts/git-integration">
Generate commit messages, explain diffs, or analyze changes with Cline's Git integration. Cline understands your version
control context.
</Card>
{" "}
<Card title="Keyboard Shortcuts" icon="keyboard" href="/features/commands-and-shortcuts/keyboard-shortcuts">
Speed up your workflow with keyboard shortcuts for common Cline actions. Quickly add code to chat, fix errors, or improve your code.
</Card>
</Columns>
### How They Work
When you use these commands, Cline:
- Captures the relevant context (selected code, file path, terminal output, etc.)
- Focuses the Cline interface
- Creates a conversation with the captured context
- In some cases, automatically generates a suggested prompt
Behind the scenes, these commands use VSCode's extension API to register commands, access editor state, and control VSCode's interface.
@@ -0,0 +1,81 @@
---
title: "Terminal Integration"
sidebarTitle: "Terminal Integration"
---
Cline's terminal integration lets you bring your terminal output directly into your conversations with Cline. Instead of copying and pasting error messages or command results, you can send them to Cline with a simple right-click in the terminal.
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/terminal-integration.png"
alt="Terminal Integration"
/>
</Frame>
## Right-Click Terminal Integration
When you're working in the VSCode terminal and see output you want to discuss with Cline:
1. Right-click in the terminal
2. Select "Add to Cline" from the context menu
3. The terminal output is immediately sent to the Cline chat panel
This is perfect for:
- Debugging build errors
- Understanding test failures
- Analyzing command output
- Getting help with error messages
The right-click terminal integration is especially useful when you're already working in the terminal and encounter an issue.
Instead of switching context to the Cline chat panel and typing a description of the problem, you can send the terminal output directly to Cline with just a couple of clicks.
Alternatively, you can use the [`@terminal`](/features/at-mentions/terminal-mentions) mention to send the full terminal output to Cline.
<Tip>
For information about using `@terminal` mentions in your chat messages, see the [Terminal
Mentions](/features/at-mentions/terminal-mentions) documentation.
</Tip>
## How Terminal Integration Works
When you use the right-click terminal integration, Cline:
1. Captures the terminal output with all formatting preserved
2. Includes the complete context, including command history and results
3. Formats it appropriately for the AI to understand
4. Enables the AI to see exactly what you're seeing
This gives Cline the full context it needs to provide accurate help with terminal-related issues.
## Behind the Scenes
The terminal integration uses a clever technique to capture terminal output:
1. When you trigger the integration, Cline:
- Temporarily saves your current clipboard content
- Selects all terminal content (or uses your existing selection)
- Copies it to the clipboard
- Reads the clipboard to get the terminal content
- Restores your original clipboard content
2. The terminal content is then:
- Formatted with proper syntax highlighting
- Added to your message or sent as a new message
- Enhanced with additional context when needed
This approach ensures that all terminal output, including colors and formatting, is accurately captured without affecting your clipboard.
## Tips for Effective Use
- **Use terminal integration for error messages**: When you encounter an error in the terminal, sending it to Cline often results in faster resolution than trying to describe the error.
- **Select specific output when needed**: By default, the integration captures all terminal content, but you can also select specific lines before right-clicking to focus on just the relevant output.
- **Combine with file mentions**: After sending terminal output to Cline, you can enhance your question by mentioning relevant files using the @ mentions feature.
- **Use for build and test output**: Terminal integration is particularly useful for understanding complex build errors or test failures that span multiple lines.
Next time you're staring at a cryptic error message in your terminal, try using Cline's terminal integration instead of copying and pasting. You'll get more accurate help because Cline can see the complete terminal context with proper formatting.
+14
View File
@@ -0,0 +1,14 @@
---
title: "Drag & Drop"
sidebarTitle: "Drag & Drop"
---
Dragging and dropping files into Cline is a quick way to add images, code, and other files to your conversations.
<Note>Due to VS Code quirks, to drag and drop files into the Cline chat input, you need to hold `Shift` while dragging.</Note>
Dragging and dropping workspace files into Cline will automatically create a [file mention](/features/at-mentions/file-mentions). This allows you to reference the file in your conversation without needing to type out the path.
### Supported File Types
Cline supports dragging external images from your file system, as well as files from your workspace.
+67
View File
@@ -0,0 +1,67 @@
---
title: "Editing Messages"
sidebarTitle: "Editing Messages"
---
Cline allows you to edit chat messages in a task after they've been submitted. This feature lets you refine your requests without starting a new task, helping you get better results with minimal disruption to your workflow.
## When to Edit Messages
You might want to edit a message when:
- You didn't get the results you wanted
- You thought of a better way to phrase your request
- You need to add more information or context
- You made a typo or error in your original message
## How to Edit Messages
1. Click on any message in the conversation (except the initial task message)
2. Edit the text as needed
3. Use the restore options to resubmit your request
<Frame>
<img
src="https://storage.googleapis.com/cline_public_images/docs/assets/message-editing.png"
alt="Message editing interface"
/>
</Frame>
## Restore Options
When you edit a message, you have two options for restoring:
### Restore Chat
The "Restore Chat" option:
- Restores just the task state
- Re-submits an API request with your edited message
- Preserves all file changes made up to that point
- Is useful when you want to keep the current state of your workspace
### Restore All
The "Restore All" option:
- Restores both the task state and workspace state
- Re-submits an API request with your edited message
- Reverts your workspace to how it was at that point in the conversation
- Uses [checkpoints](/features/checkpoints) under the hood to restore your workspace
- Is useful when you want to try a completely different approach
## Keyboard Shortcuts
When editing a message, you can use these keyboard shortcuts:
- **Escape**: Exit edit mode without making changes
- **Enter**: Restore just the task (equivalent to "Restore Chat")
- **Cmd/Ctrl + Enter**: Restore the task and workspace (equivalent to "Restore All")
- **Shift + Enter**: Insert a new line / line break in your message
## Best Practices
- Use message editing for minor adjustments to your requests
- For major changes in direction, consider starting a new task
- When using "Restore All," be aware that any file changes made after that message will be reverted
- Edit messages closer to the beginning of a conversation to avoid losing significant progress
+1 -1
View File
@@ -117,7 +117,7 @@ Complex projects often require multiple plan-act cycles:
- Use Plan mode to explore edge cases before implementation
- Switch back to Plan when encountering unexpected complexity
- Leverage file reading to validate assumptions early
- Leverage [file reading](/features/at-mentions/file-mentions) to validate assumptions early
- Have Cline write markdown files of the plan for future reference
### Common Patterns
+4 -4
View File
@@ -9,7 +9,7 @@ To invoke a workflow, type `/[workflow-name.md]` in the chat.
## How to Create and Use Workflows
Workflows live alongside Cline Rules. Creating one is straightforward:
Workflows live alongside [Cline Rules](/features/cline-rules). Creating one is straightforward:
<Frame>
<img src="https://storage.googleapis.com/cline_public_images/docs/assets/workflows.png" alt="Workflows tab in Cline" />
@@ -22,9 +22,9 @@ Workflows live alongside Cline Rules. Creating one is straightforward:
The real power comes from how you structure your workflow files. You can:
- Leverage Cline's built-in tools like `ask_followup_question`, `read_file`, and `search_files`
- Leverage Cline's [built-in tools](/exploring-clines-tools/cline-tools-guide) like `ask_followup_question`, `read_file`, `search_files`, and `new_task`
- Use command-line tools you already have installed like `gh` or `docker`
- Reference external MCP tool calls like Slack or Whatsapp
- Reference external [MCP tool calls](/mcp/mcp-overview) like Slack or Whatsapp
- Chain multiple actions together in a specific sequence
## Real-world Example
@@ -416,7 +416,7 @@ When I get a new PR to review, I used to manually gather context: checking the P
2. Paste in the PR number
3. Let Cline handle everything else
My workflow uses the `gh` command-line tool to:
My workflow uses the `gh` command-line tool and Cline's built in `ask_followup_question` to:
- Pull the PR description and comments
- Examine the diff
-8
View File
@@ -134,14 +134,6 @@ const baseConfig = {
aliasResolverPlugin,
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
{
name: "alias-plugin",
setup(build) {
build.onResolve({ filter: /^pkce-challenge$/ }, (args) => {
return { path: require.resolve("pkce-challenge/dist/index.browser.js") }
})
},
},
],
format: "cjs",
sourcesContent: false,
+2 -2
View File
@@ -32,7 +32,7 @@
التقى Cline، مساعد الذكاء الاصطناعي الذي يمكنه استخدام **سطر الأوامر** و **محرر النصوص** الخاص بك.
بفضل [قدرات Claude 3.7 Sonnet على التعليمات البرمجية الوكيلة](https://www.anthropic.com/claude/sonnet)، يمكن لـ Cline التعامل مع مهام تطوير البرامج المعقدة خطوة بخطوة. مع الأدوات التي تسمح له بإنشاء وتعديل الملفات، واستكشاف المشاريع الكبيرة، واستخدام المتصفح، وتنفيذ أوامر الطرفية (بعد منحك الإذن)، يمكنه مساعدتك بطرق تتجاوز إكمال الكود أو الدعم الفني. يمكن لـ Cline أيضًا استخدام بروتوكول سياق النموذج (MCP) لإنشاء أدوات جديدة وتوسيع قدراته الخاصة. في حين تعمل النصوص البرمجية الآلية المستقلة تقليديًا في بيئات محاصرة، توفر هذه الإضافة واجهة رسومية لموافقة المستخدم على كل تغيير في الملف وأمر طرفية، مما يوفر طريقة آمنة وسهلة الاستخدام لاستكشاف إمكانات الذكاء الاصطناعي الوكيل.
بفضل [قدرات Claude 4 Sonnet على التعليمات البرمجية الوكيلة](https://www.anthropic.com/claude/sonnet)، يمكن لـ Cline التعامل مع مهام تطوير البرامج المعقدة خطوة بخطوة. مع الأدوات التي تسمح له بإنشاء وتعديل الملفات، واستكشاف المشاريع الكبيرة، واستخدام المتصفح، وتنفيذ أوامر الطرفية (بعد منحك الإذن)، يمكنه مساعدتك بطرق تتجاوز إكمال الكود أو الدعم الفني. يمكن لـ Cline أيضًا استخدام بروتوكول سياق النموذج (MCP) لإنشاء أدوات جديدة وتوسيع قدراته الخاصة. في حين تعمل النصوص البرمجية الآلية المستقلة تقليديًا في بيئات محاصرة، توفر هذه الإضافة واجهة رسومية لموافقة المستخدم على كل تغيير في الملف وأمر طرفية، مما يوفر طريقة آمنة وسهلة الاستخدام لاستكشاف إمكانات الذكاء الاصطناعي الوكيل.
1. أدخل مهمتك وأضف الصور لتحويل المحاكاة إلى تطبيقات وظيفية أو إصلاح الأخطاء مع لقطات الشاشة.
2. يبدأ Cline بتحليل هيكل الملفات الخاصة بك وشجرة التعريف المصدرية، وإجراء عمليات بحث regex، وقراءة الملفات ذات الصلة للاطلاع على المشاريع الحالية. من خلال إدارة المعلومات التي يتم إضافتها إلى السياق بعناية، يمكن لـ Cline تقديم مساعدة قيمة حتى للمشاريع الكبيرة والمعقدة دون إرهاق نافذة السياق.
@@ -87,7 +87,7 @@
### استخدم المتصفح
مع قدرة [استخدام الكمبيوتر](https://www.anthropic.com/news/3-5-models-and-computer-use) الجديدة لـ Claude 3.5 Sonnet، يمكن لـ Cline إطلاق متصفح، والنقر على العناصر، وكتابة النص، والتمرير، والتقاط لقطات الشاشة وسجلات وحدة التحكم في كل خطوة. يسمح له هذا بالتصحيح التفاعلي، واختبار نهاية إلى نهاية، وحتى الاستخدام العام للويب! يمنحه هذا الاستقلالية لإصلاح الأخطاء البصرية وأخطاء وقت التشغيل دون الحاجة إلى نسخ ولصق سجلات الأخطاء بنفسك.
مع قدرة [استخدام الكمبيوتر](https://www.anthropic.com/news/3-5-models-and-computer-use) الجديدة لـ Claude 4 Sonnet، يمكن لـ Cline إطلاق متصفح، والنقر على العناصر، وكتابة النص، والتمرير، والتقاط لقطات الشاشة وسجلات وحدة التحكم في كل خطوة. يسمح له هذا بالتصحيح التفاعلي، واختبار نهاية إلى نهاية، وحتى الاستخدام العام للويب! يمنحه هذا الاستقلالية لإصلاح الأخطاء البصرية وأخطاء وقت التشغيل دون الحاجة إلى نسخ ولصق سجلات الأخطاء بنفسك.
حاول طلب من Cline "اختبار التطبيق"، وشاهده يشغل أمرًا مثل `npm run dev`، ويطلق خادم التطوير المحلي في متصفح، ويجري سلسلة من الاختبارات للتأكد من أن كل شيء يعمل. [شاهد عرضًا توضيحيًا هنا.](https://x.com/sdrzn/status/1850880547825823989)
+2 -2
View File
@@ -28,7 +28,7 @@
Lernen Sie Cline kennen, einen KI-Assistenten, der Ihre **CLI** u**N**d **E**ditor nutzen kann.
Dank der [agentischen Codierungsfähigkeiten von Claude 3.7 Sonnet](https://www.anthropic.com/claude/sonnet) kann Cline komplexe Softwareentwicklungsaufgaben Schritt für Schritt bewältigen. Mit Werkzeugen, die ihm das Erstellen und Bearbeiten von Dateien, das Erkunden großer Projekte, die Nutzung des Browsers und das Ausführen von Terminalbefehlen (nach Ihrer Genehmigung) ermöglichen, kann er Ihnen auf eine Weise helfen, die über die Codevervollständigung oder technischen Support hinausgeht. Cline kann sogar das Model Context Protocol (MCP) verwenden, um neue Werkzeuge zu erstellen und seine eigenen Fähigkeiten zu erweitern. Während autonome KI-Skripte traditionell in sandboxed Umgebungen laufen, bietet diese Erweiterung eine Mensch-in-der-Schleife-GUI, um jede Dateiänderung und jeden Terminalbefehl zu genehmigen, was eine sichere und zugängliche Möglichkeit bietet, das Potenzial agentischer KI zu erkunden.
Dank der [agentischen Codierungsfähigkeiten von Claude 4 Sonnet](https://www.anthropic.com/claude/sonnet) kann Cline komplexe Softwareentwicklungsaufgaben Schritt für Schritt bewältigen. Mit Werkzeugen, die ihm das Erstellen und Bearbeiten von Dateien, das Erkunden großer Projekte, die Nutzung des Browsers und das Ausführen von Terminalbefehlen (nach Ihrer Genehmigung) ermöglichen, kann er Ihnen auf eine Weise helfen, die über die Codevervollständigung oder technischen Support hinausgeht. Cline kann sogar das Model Context Protocol (MCP) verwenden, um neue Werkzeuge zu erstellen und seine eigenen Fähigkeiten zu erweitern. Während autonome KI-Skripte traditionell in sandboxed Umgebungen laufen, bietet diese Erweiterung eine Mensch-in-der-Schleife-GUI, um jede Dateiänderung und jeden Terminalbefehl zu genehmigen, was eine sichere und zugängliche Möglichkeit bietet, das Potenzial agentischer KI zu erkunden.
1. Geben Sie Ihre Aufgabe ein und fügen Sie Bilder hinzu, um Mockups in funktionale Apps zu konvertieren oder Fehler mit Screenshots zu beheben.
2. Cline beginnt mit der Analyse Ihrer Dateistruktur und Quellcode-ASTs, führt Regex-Suchen durch und liest relevante Dateien, um sich in bestehenden Projekten zurechtzufinden. Durch sorgfältiges Management der hinzugefügten Informationen kann Cline wertvolle Unterstützung auch bei großen, komplexen Projekten bieten, ohne das Kontextfenster zu überladen.
@@ -83,7 +83,7 @@ Alle von Cline vorgenommenen Änderungen werden in der Timeline Ihrer Datei aufg
### Den Browser verwenden
Mit der neuen [Computer Use](https://www.anthropic.com/news/3-5-models-and-computer-use) Fähigkeit von Claude 3.5 Sonnet kann Cline einen Browser starten, Elemente anklicken, Text eingeben und scrollen, dabei Screenshots und Konsolenprotokolle bei jedem Schritt erfassen. Dies ermöglicht interaktives Debugging, End-to-End-Tests und sogar allgemeine Webnutzung! Dies gibt ihm die Autonomie, visuelle Fehler und Laufzeitprobleme zu beheben, ohne dass Sie selbst Fehlerprotokolle kopieren und einfügen müssen.
Mit der neuen [Computer Use](https://www.anthropic.com/news/3-5-models-and-computer-use) Fähigkeit von Claude 4 Sonnet kann Cline einen Browser starten, Elemente anklicken, Text eingeben und scrollen, dabei Screenshots und Konsolenprotokolle bei jedem Schritt erfassen. Dies ermöglicht interaktives Debugging, End-to-End-Tests und sogar allgemeine Webnutzung! Dies gibt ihm die Autonomie, visuelle Fehler und Laufzeitprobleme zu beheben, ohne dass Sie selbst Fehlerprotokolle kopieren und einfügen müssen.
Versuchen Sie, Cline zu bitten, "die App zu testen", und sehen Sie zu, wie er einen Befehl wie `npm run dev` ausführt, Ihren lokal laufenden Dev-Server in einem Browser startet und eine Reihe von Tests durchführt, um zu bestätigen, dass alles funktioniert. [Sehen Sie sich hier eine Demo an.](https://x.com/sdrzn/status/1850880547825823989)
+2 -2
View File
@@ -28,7 +28,7 @@
Conozca a Cline, un asistente de IA que puede usar su **CLI** y **E**ditor.
Gracias a las [habilidades de codificación agencial de Claude 3.7 Sonnet](https://www.anthropic.com/claude/sonnet), Cline puede abordar tareas complejas de desarrollo de software paso a paso. Con herramientas que le permiten crear y editar archivos, explorar grandes proyectos, usar el navegador y ejecutar comandos de terminal (con su aprobación), puede ayudarle de una manera que va más allá de la autocompletación de código o el soporte técnico. Cline incluso puede usar el Model Context Protocol (MCP) para crear nuevas herramientas y expandir sus propias capacidades. Mientras que los scripts de IA autónomos tradicionalmente se ejecutan en entornos aislados, esta extensión ofrece una GUI con un humano en el bucle para aprobar cada cambio de archivo y comando de terminal, proporcionando una forma segura y accesible de explorar el potencial de la IA agencial.
Gracias a las [habilidades de codificación agencial de Claude 4 Sonnet](https://www.anthropic.com/claude/sonnet), Cline puede abordar tareas complejas de desarrollo de software paso a paso. Con herramientas que le permiten crear y editar archivos, explorar grandes proyectos, usar el navegador y ejecutar comandos de terminal (con su aprobación), puede ayudarle de una manera que va más allá de la autocompletación de código o el soporte técnico. Cline incluso puede usar el Model Context Protocol (MCP) para crear nuevas herramientas y expandir sus propias capacidades. Mientras que los scripts de IA autónomos tradicionalmente se ejecutan en entornos aislados, esta extensión ofrece una GUI con un humano en el bucle para aprobar cada cambio de archivo y comando de terminal, proporcionando una forma segura y accesible de explorar el potencial de la IA agencial.
1. Ingrese su tarea y agregue imágenes para convertir maquetas en aplicaciones funcionales o solucionar errores con capturas de pantalla.
2. Cline comenzará analizando su estructura de archivos y ASTs de código fuente, realizando búsquedas Regex y leyendo archivos relevantes para orientarse en proyectos existentes. Al gestionar cuidadosamente la información agregada, Cline puede proporcionar asistencia valiosa incluso en proyectos grandes y complejos sin sobrecargar la ventana de contexto.
@@ -83,7 +83,7 @@ Todos los cambios realizados por Cline se registran en la línea de tiempo de su
### Usar el navegador
Con la nueva [habilidad de uso de computadora](https://www.anthropic.com/news/3-5-models-and-computer-use) de Claude 3.5 Sonnet, Cline puede iniciar un navegador, hacer clic en elementos, escribir texto y desplazarse, capturando capturas de pantalla y registros de consola. Esto permite la depuración interactiva, pruebas de extremo a extremo e incluso el uso general de la web. Esto le da la autonomía para solucionar errores visuales y problemas de tiempo de ejecución sin que tenga que copiar y pegar registros de errores.
Con la nueva [habilidad de uso de computadora](https://www.anthropic.com/news/3-5-models-and-computer-use) de Claude 4 Sonnet, Cline puede iniciar un navegador, hacer clic en elementos, escribir texto y desplazarse, capturando capturas de pantalla y registros de consola. Esto permite la depuración interactiva, pruebas de extremo a extremo e incluso el uso general de la web. Esto le da la autonomía para solucionar errores visuales y problemas de tiempo de ejecución sin que tenga que copiar y pegar registros de errores.
Intente pedirle a Cline que "pruebe la aplicación" y observe cómo ejecuta un comando como `npm run dev`, inicia su servidor de desarrollo local en un navegador y realiza una serie de pruebas para confirmar que todo funciona. [Vea una demostración aquí.](https://x.com/sdrzn/status/1850880547825823989)
+2 -2
View File
@@ -28,7 +28,7 @@
Clineは、**CLI**と**エディター**を使用できるAIアシスタントです。
[Claude 3.7 Sonnetのエージェント的コーディング機能](https://www.anthropic.com/claude/sonnet)のおかげで、Clineは複雑なソフトウェア開発タスクをステップバイステップで処理できます。ファイルの作成と編集、大規模プロジェクトの探索、ブラウザの使用、ターミナルコマンドの実行(許可後)などのツールを使用して、コード補完や技術サポートを超えた支援を提供します。Clineは、Model Context Protocol (MCP)を使用して新しいツールを作成し、自身の機能を拡張することもできます。自律的なAIスクリプトは通常サンドボックス環境で実行されますが、この拡張機能はファイル変更やターミナルコマンドを承認するための人間インターフェースを提供し、エージェント的AIの可能性を安全かつアクセスしやすい方法で探求できます。
[Claude 4 Sonnetのエージェント的コーディング機能](https://www.anthropic.com/claude/sonnet)のおかげで、Clineは複雑なソフトウェア開発タスクをステップバイステップで処理できます。ファイルの作成と編集、大規模プロジェクトの探索、ブラウザの使用、ターミナルコマンドの実行(許可後)などのツールを使用して、コード補完や技術サポートを超えた支援を提供します。Clineは、Model Context Protocol (MCP)を使用して新しいツールを作成し、自身の機能を拡張することもできます。自律的なAIスクリプトは通常サンドボックス環境で実行されますが、この拡張機能はファイル変更やターミナルコマンドを承認するための人間インターフェースを提供し、エージェント的AIの可能性を安全かつアクセスしやすい方法で探求できます。
1. タスクを入力し、モックアップを機能するアプリに変換したり、スクリーンショットでバグを修正したりします。
2. Clineは、ファイル構造とソースコードASTの分析、正規表現検索の実行、関連ファイルの読み取りから始め、既存プロジェクトに精通します。コンテキストに追加される情報を慎重に管理することで、大規模で複雑なプロジェクトでもコンテキストウィンドウを圧倒することなく貴重な支援を提供できます。
@@ -83,7 +83,7 @@ Clineによるすべての変更はファイルのタイムラインに記録さ
### ブラウザの使用
Claude 3.5 Sonnetの新しい[コンピュータ使用](https://www.anthropic.com/news/3-5-models-and-computer-use)機能により、Clineはブラウザを起動し、要素をクリック、テキストを入力、スクロールし、各ステップでスクリーンショットとコンソールログをキャプチャできます。これにより、インタラクティブなデバッグ、エンドツーエンドテスト、さらには一般的なウェブ使用が可能になります。これにより、エラーログを手動でコピー&ペーストすることなく、視覚的なバグやランタイムの問題を自律的に修正できます。
Claude 4 Sonnetの新しい[コンピュータ使用](https://www.anthropic.com/news/3-5-models-and-computer-use)機能により、Clineはブラウザを起動し、要素をクリック、テキストを入力、スクロールし、各ステップでスクリーンショットとコンソールログをキャプチャできます。これにより、インタラクティブなデバッグ、エンドツーエンドテスト、さらには一般的なウェブ使用が可能になります。これにより、エラーログを手動でコピー&ペーストすることなく、視覚的なバグやランタイムの問題を自律的に修正できます。
Clineに「アプリをテストして」と頼んでみてください。彼は`npm run dev`のようなコマンドを実行し、ローカルで実行中の開発サーバーをブラウザで起動し、一連のテストを実行してすべてが正常に動作することを確認します。[デモはこちら。](https://x.com/sdrzn/status/1850880547825823989)
+2 -2
View File
@@ -28,7 +28,7 @@
Cline을 만나보세요, **CLI** 및 **에디터**를 활용할 수 있는 AI 어시스턴트입니다.
[Claude 3.7 Sonnet의 에이전트형 코딩 기능](https://www.anthropic.com/claude/sonnet) 덕분에, Cline은 복잡한 소프트웨어 개발 작업을 단계별로 처리할 수 있습니다. 파일 생성과 편집, 대규모 프로젝트 탐색, 브라우저 사용, 터미널 명령 실행(권한 허가 필요) 등의 도구를 사용하여 단순 코드 완성이나 기술 지원을 넘어서는 도움을 제공합니다. Cline은 Model Context Protocol(MCP)를 사용하여 새로운 도구를 만들고 자신의 기능을 확장할 수도 있습니다. 자율적인 AI 스크립트는 일반적으로 샌드박스 환경에서 실행되지만, 이 확장 프로그램은 모든 파일 변경 및 터미널 명령을 승인할 수 있는 사람이 개입가능한 GUI를 제공하여, 에이전트형 AI의 잠재력을 보다 안전하고 쉽게 탐색할 수 있도록 합니다.
[Claude 4 Sonnet의 에이전트형 코딩 기능](https://www.anthropic.com/claude/sonnet) 덕분에, Cline은 복잡한 소프트웨어 개발 작업을 단계별로 처리할 수 있습니다. 파일 생성과 편집, 대규모 프로젝트 탐색, 브라우저 사용, 터미널 명령 실행(권한 허가 필요) 등의 도구를 사용하여 단순 코드 완성이나 기술 지원을 넘어서는 도움을 제공합니다. Cline은 Model Context Protocol(MCP)를 사용하여 새로운 도구를 만들고 자신의 기능을 확장할 수도 있습니다. 자율적인 AI 스크립트는 일반적으로 샌드박스 환경에서 실행되지만, 이 확장 프로그램은 모든 파일 변경 및 터미널 명령을 승인할 수 있는 사람이 개입가능한 GUI를 제공하여, 에이전트형 AI의 잠재력을 보다 안전하고 쉽게 탐색할 수 있도록 합니다.
1. 작업을 입력하고, 목업을 기능하는 앱으로 변환하거나 스크린샷으로 버그를 수정합니다.
2. Cline은 파일 구조와 소스코드 AST의 분석, 정규식 검색 실행, 관련 파일 읽기부터 시작하여 기존 프로젝트를 파악합니다. 또한, 어떤 정보를 컨텍스트에 추가할지를 신중하게 관리하여, 대규모 복잡한 프로젝트에서도 컨텍스트 윈도우를 과부하시키지 않으면서도 효과적인 지원을 제공합니다.
@@ -78,7 +78,7 @@ Cline에 의한 모든 변경은 파일의 타임라인에 기록되어 필요
### 브라우저 사용
Claude 3.5 Sonnet의 새로운 [컴퓨터 사용](https://www.anthropic.com/news/3-5-models-and-computer-use) 기능으로 인해, Cline은 브라우저를 실행하고 요소를 클릭하고 텍스트를 입력하고 스크롤하며 각 단계에서 스크린샷과 콘솔 로그를 캡처할 수 있습니다. 이를 통해 인터랙티브한 디버깅, 엔드투엔드 테스트, 심지어 일반적인 웹 탐색까지 가능해집니다. 이로 인해 오류 로그를 수동으로 복사 & 붙여넣기 할 필요 없이 시각적 버그나 런타임 문제를 자율적으로 수정할 수 있습니다.
Claude 4 Sonnet의 새로운 [컴퓨터 사용](https://www.anthropic.com/news/3-5-models-and-computer-use) 기능으로 인해, Cline은 브라우저를 실행하고 요소를 클릭하고 텍스트를 입력하고 스크롤하며 각 단계에서 스크린샷과 콘솔 로그를 캡처할 수 있습니다. 이를 통해 인터랙티브한 디버깅, 엔드투엔드 테스트, 심지어 일반적인 웹 탐색까지 가능해집니다. 이로 인해 오류 로그를 수동으로 복사 & 붙여넣기 할 필요 없이 시각적 버그나 런타임 문제를 자율적으로 수정할 수 있습니다.
Cline에게 "앱을 테스트해줘"라고 요청하면, `npm run dev`와 같은 명령을 실행하고 로컬에서 실행 중인 개발 서버를 브라우저에서 실행하여 일련의 테스트를 수행하고 모든 것이 정상적으로 작동하는지 확인합니다. [데모는 여기를 참조하세요.](https://x.com/sdrzn/status/1850880547825823989)
+2 -2
View File
@@ -28,7 +28,7 @@
Conheça o Cline: um assistente de IA que pode usar seu **CLI** e **Editor**.
Graças às [habilidades avançadas do Claude 3.7 Sonnet](https://www.anthropic.com/claude/sonnet), o Cline pode lidar com tarefas complexas de desenvolvimento de software passo a passo. Com ferramentas que permitem criar e editar arquivos, explorar grandes projetos, usar o navegador e executar comandos no terminal (com sua aprovação), ele pode ajudar você de maneiras que vão além da inclusão de código ou suporte técnico. O Cline pode é capaz inclusive de usar o Model Context Protocol (MCP) para criar novas ferramentas e expandir seus próprios recursos. Embora os scripts de IA autônomas tradicionalmente sejam executados em ambientes isolados, esta extensão oferece uma GUI com um humano no circuito para aprovar cada alteração de arquivo e comando de terminal, fornecendo uma maneira segura e acessível de explorar todo o potencial da IA.
Graças às [habilidades avançadas do Claude 4 Sonnet](https://www.anthropic.com/claude/sonnet), o Cline pode lidar com tarefas complexas de desenvolvimento de software passo a passo. Com ferramentas que permitem criar e editar arquivos, explorar grandes projetos, usar o navegador e executar comandos no terminal (com sua aprovação), ele pode ajudar você de maneiras que vão além da inclusão de código ou suporte técnico. O Cline pode é capaz inclusive de usar o Model Context Protocol (MCP) para criar novas ferramentas e expandir seus próprios recursos. Embora os scripts de IA autônomas tradicionalmente sejam executados em ambientes isolados, esta extensão oferece uma GUI com um humano no circuito para aprovar cada alteração de arquivo e comando de terminal, fornecendo uma maneira segura e acessível de explorar todo o potencial da IA.
1. Insira sua tarefa e adicione imagens para transformar mockups em aplicativos funcionais ou corrigir erros através de capturas de tela.
@@ -83,7 +83,7 @@ Todas as alterações feitas pelo Cline são registradas na Linha do tempo do ar
### Uso do navegador
Com a nova habilidade de [uso de computador](https://www.anthropic.com/news/3-5-models-and-computer-use) do Claude Sonnet 3.5, Cline pode abrir um navegador, clicar em elementos, digitar texto e rolar, capturando a tela e logs de console. Isso permite depurar de maneira interativa, testes end-to-end e até mesmo uso geral da web. Isso lhe dá autonomia para solucionar erros visuais e problemas em tempo de execução sem precisar copiar e colar logs dos erros.
Com a nova habilidade de [uso de computador](https://www.anthropic.com/news/3-5-models-and-computer-use) do Claude Sonnet 4, Cline pode abrir um navegador, clicar em elementos, digitar texto e rolar, capturando a tela e logs de console. Isso permite depurar de maneira interativa, testes end-to-end e até mesmo uso geral da web. Isso lhe dá autonomia para solucionar erros visuais e problemas em tempo de execução sem precisar copiar e colar logs dos erros.
Tente pedir a Cline para "testar o aplicativo" e observe enquanto o Cline executa um comando como `npm run dev`, inicia seu servidor de desenvolvimento local em um navegador e executa uma série de testes para confirmar se tudo funciona. [Veja uma demonstração aqui.](https://x.com/sdrzn/status/1850880547825823989)
+2 -2
View File
@@ -28,7 +28,7 @@
认识 Cline —— 一个可以使用你的 **终端****编辑器** 的 AI 助手。
得益于 [Claude 3.7 Sonnet 的代理式编码能力](https://www.anthropic.com/claude/sonnet),Cline 能够逐步处理复杂的软件开发任务。借助于一系列工具,他可以创建和编辑文件、浏览大型项目、使用浏览器,并在你授权后执行终端命令,从而在代码补全或技术支持之外提供更深入的帮助。Cline 甚至还能使用 Model Context ProtocolMCP)来创建新工具,并扩展自身的能力。虽然传统的自动化 AI 脚本通常运行在沙盒环境中,但这个扩展提供了一个人类参与审核的图形界面(GUI),用于审批每一次文件变更和终端命令,从而为探索代理式 AI 的潜力提供了一种安全且易于使用的方式。
得益于 [Claude 4 Sonnet 的代理式编码能力](https://www.anthropic.com/claude/sonnet),Cline 能够逐步处理复杂的软件开发任务。借助于一系列工具,他可以创建和编辑文件、浏览大型项目、使用浏览器,并在你授权后执行终端命令,从而在代码补全或技术支持之外提供更深入的帮助。Cline 甚至还能使用 Model Context ProtocolMCP)来创建新工具,并扩展自身的能力。虽然传统的自动化 AI 脚本通常运行在沙盒环境中,但这个扩展提供了一个人类参与审核的图形界面(GUI),用于审批每一次文件变更和终端命令,从而为探索代理式 AI 的潜力提供了一种安全且易于使用的方式。
1. 输入你的任务,并添加图片,以将界面原型(mockup)转换为功能应用,或通过截图修复 bug。
2. Cline 会从分析你的文件结构和源代码的抽象语法树(AST)开始,同时执行正则搜索并读取相关文件,以便尽快熟悉项目上下文。通过精细地管理上下文中引入的信息,即使面对大型复杂项目,Cline 也能在不超出上下文窗口限制的前提下提供有效协助。
@@ -83,7 +83,7 @@ Cline 所做的所有更改都会记录在你的文件时间轴中,提供了
### 使用浏览器
借助 Claude 3.5 Sonnet 的新 [计算机使用](https://www.anthropic.com/news/3-5-models-and-computer-use) 功能,Cline 可以启动浏览器,点击元素,输入文本和滚动,在每一步捕获截图和控制台日志。这允许进行交互式调试、端到端测试,甚至是一般的网页使用!这使他能够自主修复视觉错误和运行时问题,而无需你亲自操作和复制粘贴错误日志。
借助 Claude 4 Sonnet 的新 [计算机使用](https://www.anthropic.com/news/3-5-models-and-computer-use) 功能,Cline 可以启动浏览器,点击元素,输入文本和滚动,在每一步捕获截图和控制台日志。这允许进行交互式调试、端到端测试,甚至是一般的网页使用!这使他能够自主修复视觉错误和运行时问题,而无需你亲自操作和复制粘贴错误日志。
试试让 Cline “测试应用程序”,看看他如何运行 `npm run dev` 命令,在浏览器中启动你本地运行的开发服务器,并执行一系列测试以确认一切正常。[在这里查看演示。](https://x.com/sdrzn/status/1850880547825823989)
+9 -6
View File
@@ -32,7 +32,7 @@
認識 Cline,一個可以使用您的**命令列介面** (CLI) 和**程式編輯器** (Editor) 的 AI 助理。
感謝 [Claude 3.7 Sonnet 的代理式程式設計能力](https://www.anthropic.com/claude/sonnet),Cline 能夠逐步處理複雜的軟體開發任務。透過能讓他建立和編輯檔案、探索大型專案、使用瀏覽器,以及執行終端機指令(在您授權後)的工具,從而在程式碼補全或技術支援之外提供更深入的協助。Cline 甚至能使用模型上下文協定(Model Context ProtocolMCP)來建立新工具並擴展自己的功能。雖然自主 AI 腳本傳統上會在沙箱環境中執行,但這個擴充套件提供了人機互動的圖形介面,讓您可以核准每個檔案變更和終端機指令,提供一個安全且容易使用的方式來探索代理式 AI 的潛力。
感謝 [Claude 4 Sonnet 的代理式程式設計能力](https://www.anthropic.com/claude/sonnet),Cline 能夠逐步處理複雜的軟體開發任務。透過能讓他建立和編輯檔案、探索大型專案、使用瀏覽器,以及執行終端機指令(在您授權後)的工具,從而在程式碼補全或技術支援之外提供更深入的協助。Cline 甚至能使用模型上下文協定(Model Context ProtocolMCP)來建立新工具並擴展自己的功能。雖然自主 AI 腳本傳統上會在沙箱環境中執行,但這個擴充套件提供了人機互動的圖形介面,讓您可以核准每個檔案變更和終端機指令,提供一個安全且容易使用的方式來探索代理式 AI 的潛力。
1. 輸入您的任務,並可以加入圖片來將設計稿轉換成功能性應用程式,或使用截圖來修正錯誤。
2. Cline 會先分析您的檔案結構和程式碼 AST、執行正規表達式搜尋,並讀取相關檔案,以便在現有專案中快速掌握狀況。透過仔細管理加入上下文的資訊,Cline 可以在不超過上下文視窗的情況下,為大型且複雜的專案提供有價值的協助。
@@ -84,7 +84,7 @@ Cline 可以直接在您的編輯器中建立和編輯檔案,並顯示變更
### 使用瀏覽器
透過 Claude 3.5 Sonnet 的新[電腦使用](https://www.anthropic.com/news/3-5-models-and-computer-use)功能,Cline 可以啟動瀏覽器、點選元素、輸入文字和捲動,在每個步驟擷取螢幕截圖和主控台記錄。這讓互動式除錯、端對端測試,甚至一般網頁使用成為可能!這讓他能獨立修正視覺問題和執行時錯誤,而不需要您手動複製錯誤記錄。
透過 Claude 4 Sonnet 的新[電腦使用](https://www.anthropic.com/news/3-5-models-and-computer-use)功能,Cline 可以啟動瀏覽器、點選元素、輸入文字和捲動,在每個步驟擷取螢幕截圖和主控台記錄。這讓互動式除錯、端對端測試,甚至一般網頁使用成為可能!這讓他能獨立修正視覺問題和執行時錯誤,而不需要您手動複製錯誤記錄。
試著請 Cline 「測試應用程式」,觀察他如何執行 `npm run dev`、在瀏覽器中啟動您的本機開發伺服器,並執行一系列測試來確認一切正常運作。[點此觀看示範](https://x.com/sdrzn/status/1850880547825823989)。
@@ -108,10 +108,13 @@ Cline 可以直接在您的編輯器中建立和編輯檔案,並顯示變更
### 新增上下文
**`@url`**貼上網址讓擴充套件擷取並轉換為 Markdown,當您想給 Cline 最新文件時很有用
**`@problems`:**新增工作區的錯誤和警告(「問題」面板)給 Cline 修正
**`@file`**新增檔案內容,讓您不必浪費 API 請求來核准讀取檔案(+ 輸入以搜尋檔案)
**`@folder`:**一次新增整個資料夾的檔案,讓您的工作流程更快速
**`@url`**貼上網址讓擴充套件擷取並轉換為 Markdown,當您想給 Cline 最新文件時很有用
**`@problems`**新增工作區的錯誤和警告(「問題」面板)給 Cline 修正
**`@file`**:新增檔案內容,讓您不必浪費 API 請求來核准讀取檔案(+ 輸入以搜尋檔案)
**`@folder`**:一次新增整個資料夾的檔案,讓您的工作流程更快速
<!-- 透明像素用於浮動圖片後的換行 -->
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
+19 -19
View File
@@ -1,12 +1,12 @@
{
"name": "claude-dev",
"version": "3.16.2",
"version": "3.17.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "claude-dev",
"version": "3.16.2",
"version": "3.17.2",
"license": "Apache-2.0",
"dependencies": {
"@anthropic-ai/bedrock-sdk": "^0.12.4",
@@ -19,7 +19,7 @@
"@grpc/grpc-js": "^1.9.15",
"@grpc/reflection": "^1.0.4",
"@mistralai/mistralai": "^1.5.0",
"@modelcontextprotocol/sdk": "^1.7.0",
"@modelcontextprotocol/sdk": "^1.11.1",
"@opentelemetry/api": "^1.4.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.39.1",
"@opentelemetry/resources": "^1.30.1",
@@ -7600,17 +7600,17 @@
"license": "BSD-2-Clause"
},
"node_modules/@modelcontextprotocol/sdk": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.7.0.tgz",
"integrity": "sha512-IYPe/FLpvF3IZrd/f5p5ffmWhMc3aEMuM2wGJASDqC2Ge7qatVCdbfPx3n/5xFeb19xN0j/911M2AaFuircsWA==",
"license": "MIT",
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.11.1.tgz",
"integrity": "sha512-9LfmxKTb1v+vUS1/emSk1f5ePmTLkb9Le9AxOB5T0XM59EUumwcS45z05h7aiZx3GI0Bl7mjb3FMEglYj+acuQ==",
"dependencies": {
"content-type": "^1.0.5",
"cors": "^2.8.5",
"cross-spawn": "^7.0.3",
"eventsource": "^3.0.2",
"express": "^5.0.1",
"express-rate-limit": "^7.5.0",
"pkce-challenge": "^4.1.0",
"pkce-challenge": "^5.0.0",
"raw-body": "^3.0.0",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.24.1"
@@ -21465,10 +21465,9 @@
}
},
"node_modules/pkce-challenge": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-4.1.0.tgz",
"integrity": "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ==",
"license": "MIT",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.0.tgz",
"integrity": "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==",
"engines": {
"node": ">=16.20.0"
}
@@ -31509,16 +31508,17 @@
"integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw=="
},
"@modelcontextprotocol/sdk": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.7.0.tgz",
"integrity": "sha512-IYPe/FLpvF3IZrd/f5p5ffmWhMc3aEMuM2wGJASDqC2Ge7qatVCdbfPx3n/5xFeb19xN0j/911M2AaFuircsWA==",
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.11.1.tgz",
"integrity": "sha512-9LfmxKTb1v+vUS1/emSk1f5ePmTLkb9Le9AxOB5T0XM59EUumwcS45z05h7aiZx3GI0Bl7mjb3FMEglYj+acuQ==",
"requires": {
"content-type": "^1.0.5",
"cors": "^2.8.5",
"cross-spawn": "^7.0.3",
"eventsource": "^3.0.2",
"express": "^5.0.1",
"express-rate-limit": "^7.5.0",
"pkce-challenge": "^4.1.0",
"pkce-challenge": "^5.0.0",
"raw-body": "^3.0.0",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.24.1"
@@ -41248,9 +41248,9 @@
"dev": true
},
"pkce-challenge": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-4.1.0.tgz",
"integrity": "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ=="
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.0.tgz",
"integrity": "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ=="
},
"pony-cause": {
"version": "1.1.1",
+20 -7
View File
@@ -2,7 +2,7 @@
"name": "claude-dev",
"displayName": "Cline",
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, running commands, using the browser, and more with your permission every step of the way.",
"version": "3.16.2",
"version": "3.17.3",
"icon": "assets/icons/icon.png",
"engines": {
"vscode": "^1.84.0"
@@ -50,8 +50,21 @@
"activitybar": [
{
"id": "claude-dev-ActivityBar",
"title": "Cline",
"icon": "assets/icons/icon.svg"
"title": "Cline (⌘+')",
"icon": "assets/icons/icon.svg",
"when": "isMac"
},
{
"id": "claude-dev-ActivityBar",
"title": "Cline (Ctrl+')",
"icon": "assets/icons/icon.svg",
"when": "isWindows"
},
{
"id": "claude-dev-ActivityBar",
"title": "Cline (Ctrl+')",
"icon": "assets/icons/icon.svg",
"when": "isLinux || !isMac && !isWindows"
}
]
},
@@ -260,18 +273,18 @@
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "npm run check-types && npm run lint && node esbuild.js",
"compile-standalone": "npm run protos && npm run check-types && npm run lint && node esbuild.js --standalone",
"compile-standalone": "npm run check-types && npm run lint && node esbuild.js --standalone",
"postcompile-standalone": "node scripts/package-standalone.mjs",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"package": "npm run build:webview && npm run check-types && npm run lint && node esbuild.js --production",
"package": "npm run check-types && npm run build:webview && npm run lint && node esbuild.js --production",
"protos": "node proto/build-proto.js && node scripts/generate-server-setup.mjs",
"postprotos": "prettier src/shared/proto src/core/controller webview-ui/src/services src/standalone/server-setup.ts --write --log-level silent",
"compile-tests": "node ./scripts/build-tests.js",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"check-types": "tsc --noEmit",
"check-types": "npm run protos && tsc --noEmit",
"lint": "eslint src --ext ts && eslint webview-ui/src --ext ts",
"format": "prettier . --check",
"format:fix": "prettier . --write",
@@ -341,7 +354,7 @@
"@grpc/grpc-js": "^1.9.15",
"@grpc/reflection": "^1.0.4",
"@mistralai/mistralai": "^1.5.0",
"@modelcontextprotocol/sdk": "^1.7.0",
"@modelcontextprotocol/sdk": "^1.11.1",
"@opentelemetry/api": "^1.4.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.39.1",
"@opentelemetry/resources": "^1.30.1",
+13
View File
@@ -46,6 +46,19 @@ service FileService {
// Toggle a Windsurf rule (enable or disable)
rpc toggleWindsurfRule(ToggleWindsurfRuleRequest) returns (ClineRulesToggles);
// Refreshes all rule toggles (Cline, External, and Workflows)
rpc refreshRules(EmptyRequest) returns (RefreshedRules);
}
// Response for refreshRules operation
message RefreshedRules {
ClineRulesToggles global_cline_rules_toggles = 1;
ClineRulesToggles local_cline_rules_toggles = 2;
ClineRulesToggles local_cursor_rules_toggles = 3;
ClineRulesToggles local_windsurf_rules_toggles = 4;
ClineRulesToggles local_workflow_toggles = 5;
ClineRulesToggles global_workflow_toggles = 6;
}
// Request to toggle a Windsurf rule
+24
View File
@@ -10,6 +10,7 @@ service StateService {
rpc resetState(EmptyRequest) returns (Empty);
rpc togglePlanActMode(TogglePlanActModeRequest) returns (Empty);
rpc updateTerminalConnectionTimeout(Int64Request) returns (Int64);
rpc updateAutoApprovalSettings(AutoApprovalSettingsRequest) returns (Empty);
}
message State {
@@ -37,3 +38,26 @@ message ChatContent {
optional string message = 1;
repeated string images = 2;
}
// Message for auto approval settings
message AutoApprovalSettingsRequest {
Metadata metadata = 1;
message Actions {
bool read_files = 1;
bool read_files_externally = 2;
bool edit_files = 3;
bool edit_files_externally = 4;
bool execute_safe_commands = 5;
bool execute_all_commands = 6;
bool use_browser = 7;
bool use_mcp = 8;
}
int32 version = 2;
bool enabled = 3;
Actions actions = 4;
int32 max_requests = 5;
bool enable_notifications = 6;
repeated string favorites = 7;
}
+3 -1
View File
@@ -10,5 +10,7 @@ import "common.proto";
service UiService {
// Scrolls to a specific settings section in the settings view
rpc scrollToSettings(StringRequest) returns (Empty);
// Marks the current announcement as shown and returns whether an announcement should still be shown
rpc onDidShowAnnouncement(EmptyRequest) returns (Boolean);
}
+12 -3
View File
@@ -3,7 +3,8 @@ set -eu
DIR=${1:-src/}
DEST_DIR=dist-standalone
DEST=dist-standalone/vscode-uses.txt
SDK_DEST=$DEST_DIR/vscode-sdk-uses.txt
CSS_DEST=$DEST_DIR/vscode-css-uses.txt
mkdir -p $DEST_DIR
{
@@ -11,8 +12,16 @@ git grep -h 'vscode\.' $DIR |
grep -Ev '//.*vscode' | # remove commented out code
sed 's|.*vscode\.|vscode.|'| # remove everything before vscode.
sed 's/[^a-zA-Z0-9_.].*$//' | # remove everything after last identifier
sort | uniq > $DEST
sort | uniq > $SDK_DEST
}
echo Wrote uses of the vscode SDK to $(realpath $SDK_DEST)
echo Done, wrote uses of the vscode SDK to $(realpath $DEST)
{
grep -rh -- --vscode- webview-ui/build/ |
sed 's/--vscode/\n--vscode/g' | # One var per line
grep -- --vscode | # Remove lines that don't have vars.
sed 's/[),"\\].*$//' | # remove from the end of the var name to the end of the line.
sort | uniq > $CSS_DEST
}
echo Wrote vscode vars used to $(realpath $CSS_DEST)
+3
View File
@@ -13,6 +13,7 @@ import { ApiStream, ApiStreamUsageChunk } from "./transform/stream"
import { DeepSeekHandler } from "./providers/deepseek"
import { RequestyHandler } from "./providers/requesty"
import { TogetherHandler } from "./providers/together"
import { NebiusHandler } from "./providers/nebius"
import { QwenHandler } from "./providers/qwen"
import { MistralHandler } from "./providers/mistral"
import { DoubaoHandler } from "./providers/doubao"
@@ -75,6 +76,8 @@ export function buildApiHandler(configuration: ApiConfiguration): ApiHandler {
return new ClineHandler(options)
case "litellm":
return new LiteLlmHandler(options)
case "nebius":
return new NebiusHandler(options)
case "asksage":
return new AskSageHandler(options)
case "xai":
+145
View File
@@ -0,0 +1,145 @@
import "should"
import { AwsBedrockHandler } from "../bedrock"
import { ApiHandlerOptions } from "@shared/api"
describe("AwsBedrockHandler", () => {
describe("withTempEnv", () => {
// Store original env vars for cleanup
const originalEnv: Record<string, string | undefined> = {}
beforeEach(() => {
// Store original values before each test
originalEnv.TEST_VAR = process.env.TEST_VAR
originalEnv.ANOTHER_VAR = process.env.ANOTHER_VAR
originalEnv.VAR1 = process.env.VAR1
originalEnv.VAR2 = process.env.VAR2
originalEnv.VAR3 = process.env.VAR3
originalEnv.UNDEFINED_VAR = process.env.UNDEFINED_VAR
})
afterEach(() => {
// Restore original values after each test
Object.entries(originalEnv).forEach(([key, value]) => {
if (value === undefined) {
delete process.env[key]
} else {
process.env[key] = value
}
})
})
it("should restore original environment variables after operation", async () => {
// Set initial environment
process.env.TEST_VAR = "original"
process.env.ANOTHER_VAR = "another"
// Store original values
const originalTestVar = process.env.TEST_VAR
const originalAnotherVar = process.env.ANOTHER_VAR
await AwsBedrockHandler["withTempEnv"](
() => {
process.env.TEST_VAR = "modified"
delete process.env.ANOTHER_VAR
},
async () => {
// Verify environment is modified
process.env.TEST_VAR!.should.equal("modified")
should.not.exist(process.env.ANOTHER_VAR)
return "test"
},
)
// Verify environment is restored
process.env.TEST_VAR!.should.equal(originalTestVar)
process.env.ANOTHER_VAR!.should.equal(originalAnotherVar)
})
it("should handle undefined environment variables", async () => {
await AwsBedrockHandler["withTempEnv"](
() => {
delete process.env.UNDEFINED_VAR
},
async () => {
should.not.exist(process.env.UNDEFINED_VAR)
return "test"
},
)
// Verify undefined variable is not present
should.not.exist(process.env.UNDEFINED_VAR)
})
it("should handle errors and still restore environment", async () => {
// Set initial environment
process.env.TEST_VAR = "original"
try {
await AwsBedrockHandler["withTempEnv"](
() => {
process.env.TEST_VAR = "modified"
},
async () => {
throw new Error("Test error")
},
)
should.fail(null, null, "Expected error was not thrown", "throw")
} catch (error) {
;(error as Error).message.should.equal("Test error")
}
// Verify environment is restored even after error
process.env.TEST_VAR!.should.equal("original")
})
it("should handle multiple environment variable changes", async () => {
// Set initial environment
process.env.VAR1 = "original1"
process.env.VAR2 = "original2"
process.env.VAR3 = "original3"
// Store original values
const originalVar1 = process.env.VAR1
const originalVar2 = process.env.VAR2
const originalVar3 = process.env.VAR3
await AwsBedrockHandler["withTempEnv"](
() => {
process.env.VAR1 = "modified1"
process.env.VAR2 = "modified2"
delete process.env.VAR3
},
async () => {
// Verify environment is modified
process.env.VAR1!.should.equal("modified1")
process.env.VAR2!.should.equal("modified2")
should.not.exist(process.env.VAR3)
return "test"
},
)
// Verify environment is restored
process.env.VAR1!.should.equal(originalVar1)
process.env.VAR2!.should.equal(originalVar2)
process.env.VAR3!.should.equal(originalVar3)
})
it("should work with AWS_PROFILE", async () => {
process.env["AWS_PROFILE"] = "test-profile"
const preAWSProfile = process.env["AWS_PROFILE"]
await AwsBedrockHandler["withTempEnv"](
() => {
delete process.env["AWS_PROFILE"]
},
async () => {
should.not.exist(process.env["AWS_PROFILE"])
return "test"
},
)
process.env["AWS_PROFILE"]!.should.equal(preAWSProfile)
})
})
})
+5 -1
View File
@@ -24,13 +24,15 @@ export class AnthropicHandler implements ApiHandler {
const modelId = model.id
const budget_tokens = this.options.thinkingBudgetTokens || 0
const reasoningOn = modelId.includes("3-7") && budget_tokens !== 0 ? true : false
const reasoningOn = (modelId.includes("3-7") || modelId.includes("4-")) && budget_tokens !== 0 ? true : false
switch (modelId) {
// 'latest' alias does not support cache_control
case "claude-sonnet-4-20250514":
case "claude-3-7-sonnet-20250219":
case "claude-3-5-sonnet-20241022":
case "claude-3-5-haiku-20241022":
case "claude-opus-4-20250514":
case "claude-3-opus-20240229":
case "claude-3-haiku-20240307": {
/*
@@ -96,6 +98,8 @@ export class AnthropicHandler implements ApiHandler {
// https://github.com/anthropics/anthropic-sdk-typescript?tab=readme-ov-file#default-headers
// https://github.com/anthropics/anthropic-sdk-typescript/commit/c920b77fc67bd839bfeb6716ceab9d7c9bbe7393
switch (modelId) {
case "claude-sonnet-4-20250514":
case "claude-opus-4-20250514":
case "claude-3-7-sonnet-20250219":
case "claude-3-5-sonnet-20241022":
case "claude-3-5-haiku-20241022":
+70 -50
View File
@@ -47,7 +47,11 @@ export class AwsBedrockHandler implements ApiHandler {
}
const budget_tokens = this.options.thinkingBudgetTokens || 0
const reasoningOn = baseModelId.includes("3-7") && budget_tokens !== 0 ? true : false
const reasoningOn =
(baseModelId.includes("3-7") || baseModelId.includes("sonnet-4") || baseModelId.includes("opus-4")) &&
budget_tokens !== 0
? true
: false
// Get model info and message indices for caching
const userMsgIndices = messages.reduce((acc, msg, index) => (msg.role === "user" ? [...acc, index] : acc), [] as number[])
@@ -58,56 +62,62 @@ export class AwsBedrockHandler implements ApiHandler {
// initialization, and allowing for session renewal if necessary as well
const client = await this.getAnthropicClient()
// AWS SDK prioritizes AWS_PROFILE over AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair
// If this is set as an env variable already (ie. from ~/.zshrc) it will override credentials configured by Cline
const previousEnv = process.env
delete process.env["AWS_PROFILE"]
const stream = await client.messages.create({
model: modelId,
max_tokens: model.info.maxTokens || 8192,
thinking: reasoningOn ? { type: "enabled", budget_tokens: budget_tokens } : undefined,
temperature: reasoningOn ? undefined : 0,
system: [
{
text: systemPrompt,
type: "text",
...(this.options.awsBedrockUsePromptCache === true && {
cache_control: { type: "ephemeral" },
}),
},
],
messages: messages.map((message, index) => {
if (index === lastUserMsgIndex || index === secondLastMsgUserIndex) {
return {
...message,
content:
typeof message.content === "string"
? [
{
type: "text",
text: message.content,
...(this.options.awsBedrockUsePromptCache === true && {
cache_control: { type: "ephemeral" },
}),
},
]
: message.content.map((content, contentIndex) =>
contentIndex === message.content.length - 1
? {
...content,
// Use withTempEnv to ensure environment variables are properly restored
const stream = await AwsBedrockHandler.withTempEnv(
() => {
// AWS SDK prioritizes AWS_PROFILE over AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair
// If this is set as an env variable already (ie. from ~/.zshrc) it will override credentials configured by Cline
// Temporarily remove AWS_PROFILE to ensure our credentials are used
delete process.env["AWS_PROFILE"]
},
async () => {
return await client.messages.create({
model: modelId,
max_tokens: model.info.maxTokens || 8192,
thinking: reasoningOn ? { type: "enabled", budget_tokens: budget_tokens } : undefined,
temperature: reasoningOn ? undefined : 0,
system: [
{
text: systemPrompt,
type: "text",
...(this.options.awsBedrockUsePromptCache === true && {
cache_control: { type: "ephemeral" },
}),
},
],
messages: messages.map((message, index) => {
if (index === lastUserMsgIndex || index === secondLastMsgUserIndex) {
return {
...message,
content:
typeof message.content === "string"
? [
{
type: "text",
text: message.content,
...(this.options.awsBedrockUsePromptCache === true && {
cache_control: { type: "ephemeral" },
}),
}
: content,
),
}
}
return message
}),
stream: true,
})
process.env = previousEnv
},
]
: message.content.map((content, contentIndex) =>
contentIndex === message.content.length - 1
? {
...content,
...(this.options.awsBedrockUsePromptCache === true && {
cache_control: { type: "ephemeral" },
}),
}
: content,
),
}
}
return message
}),
stream: true,
})
},
)
for await (const chunk of stream) {
switch (chunk.type) {
@@ -297,13 +307,23 @@ export class AwsBedrockHandler implements ApiHandler {
}
private static async withTempEnv<R>(updateEnv: () => void, fn: () => Promise<R>): Promise<R> {
const previousEnv = { ...process.env }
const previousEnv = Object.assign({}, process.env)
try {
updateEnv()
return await fn()
} finally {
process.env = previousEnv
// Restore the previous environment
// First clear any new variables that might have been added
for (const key in process.env) {
if (!(key in previousEnv)) {
delete process.env[key]
}
}
// Then restore all previous values
for (const key in previousEnv) {
process.env[key] = previousEnv[key]
}
}
}
+17 -7
View File
@@ -19,13 +19,23 @@ export class MistralHandler implements ApiHandler {
@withRetry()
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
const stream = await this.client.chat.stream({
model: this.getModel().id,
// max_completion_tokens: this.getModel().info.maxTokens,
temperature: 0,
messages: [{ role: "system", content: systemPrompt }, ...convertToMistralMessages(messages)],
stream: true,
})
const stream = await this.client.chat
.stream({
model: this.getModel().id,
// max_completion_tokens: this.getModel().info.maxTokens,
temperature: 0,
messages: [{ role: "system", content: systemPrompt }, ...convertToMistralMessages(messages)],
stream: true,
})
.catch((err) => {
// The Mistal SDK uses statusCode instead of status
// However, if they introduce status for something, I don't want to override it
if ("statusCode" in err && !("status" in err)) {
err.status = err.statusCode
}
throw err
})
for await (const chunk of stream) {
const delta = chunk.data.choices[0]?.delta
+69
View File
@@ -0,0 +1,69 @@
import { Anthropic } from "@anthropic-ai/sdk"
import OpenAI from "openai"
import { withRetry } from "../retry"
import { ApiHandler } from "../index"
import { convertToOpenAiMessages } from "../transform/openai-format"
import { ApiStream } from "../transform/stream"
import { convertToR1Format } from "../transform/r1-format"
import { nebiusDefaultModelId, nebiusModels, type ModelInfo, type ApiHandlerOptions, type NebiusModelId } from "../../shared/api"
export class NebiusHandler implements ApiHandler {
private client: OpenAI
constructor(private readonly options: ApiHandlerOptions) {
this.client = new OpenAI({
baseURL: "https://api.studio.nebius.ai/v1",
apiKey: this.options.nebiusApiKey,
})
}
@withRetry()
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
const model = this.getModel()
const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = model.id.includes("DeepSeek-R1")
? convertToR1Format([{ role: "user", content: systemPrompt }, ...messages])
: [{ role: "system", content: systemPrompt }, ...convertToOpenAiMessages(messages)]
const stream = await this.client.chat.completions.create({
model: model.id,
messages: openAiMessages,
temperature: 0,
stream: true,
stream_options: { include_usage: true },
})
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta
if (delta?.content) {
yield {
type: "text",
text: delta.content,
}
}
if (delta && "reasoning_content" in delta && delta.reasoning_content) {
yield {
type: "reasoning",
reasoning: (delta.reasoning_content as string | undefined) || "",
}
}
if (chunk.usage) {
yield {
type: "usage",
inputTokens: chunk.usage.prompt_tokens || 0,
outputTokens: chunk.usage.completion_tokens || 0,
}
}
}
}
getModel(): { id: string; info: ModelInfo } {
const modelId = this.options.apiModelId
if (modelId !== undefined && modelId in nebiusModels) {
return { id: modelId, info: nebiusModels[modelId as NebiusModelId] }
}
return { id: nebiusDefaultModelId, info: nebiusModels[nebiusDefaultModelId] }
}
}
+34 -25
View File
@@ -7,6 +7,16 @@ import { convertToOpenAiMessages } from "@api/transform/openai-format"
import { calculateApiCostOpenAI } from "@utils/cost"
import { ApiStream } from "@api/transform/stream"
// Requesty usage includes an extra field for Anthropic use cases.
// Safely cast the prompt token details section to the appropriate structure.
interface RequestyUsage extends OpenAI.CompletionUsage {
prompt_tokens_details?: {
caching_tokens?: number
cached_tokens?: number
}
total_cost?: number
}
export class RequestyHandler implements ApiHandler {
private options: ApiHandlerOptions
private client: OpenAI
@@ -41,7 +51,10 @@ export class RequestyHandler implements ApiHandler {
thinkingBudget > 0
? { thinking: { type: "enabled", budget_tokens: thinkingBudget } }
: { thinking: { type: "disabled" } }
const thinkingArgs = model.id.includes("claude-3-7-sonnet") ? thinking : {}
const thinkingArgs =
model.id.includes("claude-3-7-sonnet") || model.id.includes("claude-sonnet-4") || model.id.includes("claude-opus-4")
? thinking
: {}
// @ts-ignore-next-line
const stream = await this.client.chat.completions.create({
@@ -55,6 +68,8 @@ export class RequestyHandler implements ApiHandler {
...thinkingArgs,
})
let lastUsage: any = undefined
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta
if (delta?.content) {
@@ -71,32 +86,26 @@ export class RequestyHandler implements ApiHandler {
}
}
// Requesty usage includes an extra field for Anthropic use cases.
// Safely cast the prompt token details section to the appropriate structure.
interface RequestyUsage extends OpenAI.CompletionUsage {
prompt_tokens_details?: {
caching_tokens?: number
cached_tokens?: number
}
total_cost?: number
}
if (chunk.usage) {
const usage = chunk.usage as RequestyUsage
const inputTokens = usage.prompt_tokens || 0
const outputTokens = usage.completion_tokens || 0
const cacheWriteTokens = usage.prompt_tokens_details?.caching_tokens || undefined
const cacheReadTokens = usage.prompt_tokens_details?.cached_tokens || undefined
const totalCost = calculateApiCostOpenAI(model.info, inputTokens, outputTokens, cacheWriteTokens, cacheReadTokens)
lastUsage = chunk.usage
}
}
yield {
type: "usage",
inputTokens: inputTokens,
outputTokens: outputTokens,
cacheWriteTokens: cacheWriteTokens,
cacheReadTokens: cacheReadTokens,
totalCost: totalCost,
}
if (lastUsage) {
const usage = lastUsage as RequestyUsage
const inputTokens = usage.prompt_tokens || 0
const outputTokens = usage.completion_tokens || 0
const cacheWriteTokens = usage.prompt_tokens_details?.caching_tokens || undefined
const cacheReadTokens = usage.prompt_tokens_details?.cached_tokens || undefined
const totalCost = calculateApiCostOpenAI(model.info, inputTokens, outputTokens, cacheWriteTokens, cacheReadTokens)
yield {
type: "usage",
inputTokens: inputTokens,
outputTokens: outputTokens,
cacheWriteTokens: cacheWriteTokens,
cacheReadTokens: cacheReadTokens,
totalCost: totalCost,
}
}
}
+6 -1
View File
@@ -41,10 +41,15 @@ export class VertexHandler implements ApiHandler {
// Claude implementation
let budget_tokens = this.options.thinkingBudgetTokens || 0
const reasoningOn = modelId.includes("3-7") && budget_tokens !== 0 ? true : false
const reasoningOn =
(modelId.includes("3-7") || modelId.includes("sonnet-4") || modelId.includes("opus-4")) && budget_tokens !== 0
? true
: false
let stream
switch (modelId) {
case "claude-sonnet-4@20250514":
case "claude-opus-4@20250514":
case "claude-3-7-sonnet@20250219":
case "claude-3-5-sonnet-v2@20241022":
case "claude-3-5-sonnet@20240620":
+6
View File
@@ -23,6 +23,8 @@ export async function createOpenRouterStream(
// this was initially specifically for claude models (some models may 'support prompt caching' automatically without this)
// handles direct model.id match logic
switch (model.id) {
case "anthropic/claude-sonnet-4":
case "anthropic/claude-opus-4":
case "anthropic/claude-3.7-sonnet":
case "anthropic/claude-3.7-sonnet:beta":
case "anthropic/claude-3.7-sonnet:thinking":
@@ -79,6 +81,8 @@ export async function createOpenRouterStream(
// (models usually default to max tokens allowed)
let maxTokens: number | undefined
switch (model.id) {
case "anthropic/claude-sonnet-4":
case "anthropic/claude-opus-4":
case "anthropic/claude-3.7-sonnet":
case "anthropic/claude-3.7-sonnet:beta":
case "anthropic/claude-3.7-sonnet:thinking":
@@ -112,6 +116,8 @@ export async function createOpenRouterStream(
let reasoning: { max_tokens: number } | undefined = undefined
switch (model.id) {
case "anthropic/claude-sonnet-4":
case "anthropic/claude-opus-4":
case "anthropic/claude-3.7-sonnet":
case "anthropic/claude-3.7-sonnet:beta":
case "anthropic/claude-3.7-sonnet:thinking":
@@ -1,5 +1,5 @@
import { fileExistsAtPath, isDirectory, readDirectory } from "@utils/fs"
import { ensureRulesDirectoryExists, GlobalFileNames } from "@core/storage/disk"
import { ensureRulesDirectoryExists, ensureWorkflowsDirectoryExists, GlobalFileNames } from "@core/storage/disk"
import { getGlobalState, getWorkspaceState, updateGlobalState, updateWorkspaceState } from "@core/storage/state"
import * as path from "path"
import fs from "fs/promises"
@@ -172,9 +172,13 @@ export const createRuleFile = async (isGlobal: boolean, filename: string, cwd: s
try {
let filePath: string
if (isGlobal) {
// global means its implicitly clinerules
const globalClineRulesFilePath = await ensureRulesDirectoryExists()
filePath = path.join(globalClineRulesFilePath, filename)
if (type === "workflow") {
const globalClineWorkflowFilePath = await ensureWorkflowsDirectoryExists()
filePath = path.join(globalClineWorkflowFilePath, filename)
} else {
const globalClineRulesFilePath = await ensureRulesDirectoryExists()
filePath = path.join(globalClineRulesFilePath, filename)
}
} else {
const localClineRulesFilePath = path.resolve(cwd, GlobalFileNames.clineRules)
@@ -243,9 +247,15 @@ export async function deleteRuleFile(
// Update the appropriate toggles
if (isGlobal) {
const toggles = ((await getGlobalState(context, "globalClineRulesToggles")) as ClineRulesToggles) || {}
delete toggles[rulePath]
await updateGlobalState(context, "globalClineRulesToggles", toggles)
if (type === "workflow") {
const toggles = ((await getGlobalState(context, "globalWorkflowToggles")) as ClineRulesToggles) || {}
delete toggles[rulePath]
await updateGlobalState(context, "globalWorkflowToggles", toggles)
} else {
const toggles = ((await getGlobalState(context, "globalClineRulesToggles")) as ClineRulesToggles) || {}
delete toggles[rulePath]
await updateGlobalState(context, "globalClineRulesToggles", toggles)
}
} else {
if (type === "workflow") {
const toggles = ((await getWorkspaceState(context, "workflowToggles")) as ClineRulesToggles) || {}
@@ -1,7 +1,7 @@
import path from "path"
import { GlobalFileNames } from "@core/storage/disk"
import { GlobalFileNames, ensureWorkflowsDirectoryExists } from "@core/storage/disk"
import { ClineRulesToggles } from "@shared/cline-rules"
import { getWorkspaceState, updateWorkspaceState } from "@core/storage/state"
import { getWorkspaceState, updateWorkspaceState, getGlobalState, updateGlobalState } from "@core/storage/state"
import * as vscode from "vscode"
import { synchronizeRuleToggles } from "@core/context/instructions/user-instructions/rule-helpers"
@@ -11,10 +11,23 @@ import { synchronizeRuleToggles } from "@core/context/instructions/user-instruct
export async function refreshWorkflowToggles(
context: vscode.ExtensionContext,
workingDirectory: string,
): Promise<ClineRulesToggles> {
): Promise<{
globalWorkflowToggles: ClineRulesToggles
localWorkflowToggles: ClineRulesToggles
}> {
// Global workflows
const globalWorkflowToggles = ((await getGlobalState(context, "globalWorkflowToggles")) as ClineRulesToggles) || {}
const globalClineWorkflowsFilePath = await ensureWorkflowsDirectoryExists()
const updatedGlobalWorkflowToggles = await synchronizeRuleToggles(globalClineWorkflowsFilePath, globalWorkflowToggles)
await updateGlobalState(context, "globalWorkflowToggles", updatedGlobalWorkflowToggles)
const workflowRulesToggles = ((await getWorkspaceState(context, "workflowToggles")) as ClineRulesToggles) || {}
const workflowsDirPath = path.resolve(workingDirectory, GlobalFileNames.workflows)
const updatedWorkflowToggles = await synchronizeRuleToggles(workflowsDirPath, workflowRulesToggles)
await updateWorkspaceState(context, "workflowToggles", updatedWorkflowToggles)
return updatedWorkflowToggles
return {
globalWorkflowToggles: updatedGlobalWorkflowToggles,
localWorkflowToggles: updatedWorkflowToggles,
}
}
+2
View File
@@ -10,6 +10,7 @@ import { getRelativePaths } from "./getRelativePaths"
import { openFile } from "./openFile"
import { openImage } from "./openImage"
import { openMention } from "./openMention"
import { refreshRules } from "./refreshRules"
import { searchCommits } from "./searchCommits"
import { searchFiles } from "./searchFiles"
import { selectImages } from "./selectImages"
@@ -27,6 +28,7 @@ export function registerAllMethods(): void {
registerMethod("openFile", openFile)
registerMethod("openImage", openImage)
registerMethod("openMention", openMention)
registerMethod("refreshRules", refreshRules)
registerMethod("searchCommits", searchCommits)
registerMethod("searchFiles", searchFiles)
registerMethod("selectImages", selectImages)
+33
View File
@@ -0,0 +1,33 @@
import { EmptyRequest } from "@shared/proto/common"
import { RefreshedRules } from "@shared/proto/file"
import type { Controller } from "../index"
import { refreshClineRulesToggles } from "@core/context/instructions/user-instructions/cline-rules"
import { refreshExternalRulesToggles } from "@core/context/instructions/user-instructions/external-rules"
import { refreshWorkflowToggles } from "@core/context/instructions/user-instructions/workflows"
import { cwd } from "@core/task"
/**
* Refreshes all rule toggles (Cline, External, and Workflows)
* @param controller The controller instance
* @param _request The empty request
* @returns RefreshedRules containing updated toggles for all rule types
*/
export async function refreshRules(controller: Controller, _request: EmptyRequest): Promise<RefreshedRules> {
try {
const { globalToggles, localToggles } = await refreshClineRulesToggles(controller.context, cwd)
const { cursorLocalToggles, windsurfLocalToggles } = await refreshExternalRulesToggles(controller.context, cwd)
const { localWorkflowToggles, globalWorkflowToggles } = await refreshWorkflowToggles(controller.context, cwd)
return {
globalClineRulesToggles: { toggles: globalToggles },
localClineRulesToggles: { toggles: localToggles },
localCursorRulesToggles: { toggles: cursorLocalToggles },
localWindsurfRulesToggles: { toggles: windsurfLocalToggles },
localWorkflowToggles: { toggles: localWorkflowToggles },
globalWorkflowToggles: { toggles: globalWorkflowToggles },
}
} catch (error) {
console.error("Failed to refresh rules:", error)
throw error
}
}
+25 -39
View File
@@ -32,7 +32,12 @@ import { fileExistsAtPath } from "@utils/fs"
import { getWorkingState } from "@utils/git"
import { extractCommitMessage } from "@integrations/git/commit-message-generator"
import { getTotalTasksSize } from "@utils/storage"
import { ensureMcpServersDirectoryExists, ensureSettingsDirectoryExists, GlobalFileNames } from "../storage/disk"
import {
ensureMcpServersDirectoryExists,
ensureSettingsDirectoryExists,
GlobalFileNames,
ensureWorkflowsDirectoryExists,
} from "../storage/disk"
import {
getAllExtensionState,
getGlobalState,
@@ -65,7 +70,7 @@ export class Controller {
workspaceTracker: WorkspaceTracker
mcpHub: McpHub
accountService: ClineAccountService
private latestAnnouncementId = "may-16-2025_16:11:00" // update to some unique identifier when we add a new announcement
latestAnnouncementId = "may-22-2025_16:11:00" // update to some unique identifier when we add a new announcement
constructor(
readonly context: vscode.ExtensionContext,
@@ -291,25 +296,6 @@ export class Controller {
}
await this.postStateToWebview()
break
case "autoApprovalSettings":
if (message.autoApprovalSettings) {
const currentSettings = (await getAllExtensionState(this.context)).autoApprovalSettings
const incomingVersion = message.autoApprovalSettings.version ?? 1
const currentVersion = currentSettings?.version ?? 1
if (incomingVersion > currentVersion) {
await updateGlobalState(this.context, "autoApprovalSettings", message.autoApprovalSettings)
if (this.task) {
this.task.autoApprovalSettings = message.autoApprovalSettings
}
await this.postStateToWebview()
}
}
break
case "togglePlanActMode":
if (message.chatSettings) {
await this.togglePlanActModeWithChatSettings(message.chatSettings, message.chatContent)
}
break
case "optionsResponse":
await this.postMessageToWebview({
type: "invoke",
@@ -317,16 +303,6 @@ export class Controller {
text: message.text,
})
break
case "didShowAnnouncement":
await updateGlobalState(this.context, "lastShownAnnouncementId", this.latestAnnouncementId)
await this.postStateToWebview()
break
case "refreshClineRules":
await refreshClineRulesToggles(this.context, cwd)
await refreshExternalRulesToggles(this.context, cwd)
await refreshWorkflowToggles(this.context, cwd)
await this.postStateToWebview()
break
case "openInBrowser":
if (message.url) {
vscode.env.openExternal(vscode.Uri.parse(message.url))
@@ -387,12 +363,20 @@ export class Controller {
// break
// }
case "toggleWorkflow": {
const { workflowPath, enabled } = message
if (workflowPath && typeof enabled === "boolean") {
const toggles = ((await getWorkspaceState(this.context, "workflowToggles")) as ClineRulesToggles) || {}
toggles[workflowPath] = enabled
await updateWorkspaceState(this.context, "workflowToggles", toggles)
await this.postStateToWebview()
const { workflowPath, enabled, isGlobal } = message
if (workflowPath && typeof enabled === "boolean" && typeof isGlobal === "boolean") {
if (isGlobal) {
const globalWorkflowToggles =
((await getGlobalState(this.context, "globalWorkflowToggles")) as ClineRulesToggles) || {}
globalWorkflowToggles[workflowPath] = enabled
await updateGlobalState(this.context, "globalWorkflowToggles", globalWorkflowToggles)
await this.postStateToWebview()
} else {
const toggles = ((await getWorkspaceState(this.context, "workflowToggles")) as ClineRulesToggles) || {}
toggles[workflowPath] = enabled
await updateWorkspaceState(this.context, "workflowToggles", toggles)
await this.postStateToWebview()
}
}
break
}
@@ -1265,6 +1249,7 @@ export class Controller {
planActSeparateModelsSetting,
enableCheckpointsSetting,
globalClineRulesToggles,
globalWorkflowToggles,
shellIntegrationTimeout,
isNewUser,
} = await getAllExtensionState(this.context)
@@ -1278,7 +1263,7 @@ export class Controller {
const localCursorRulesToggles =
((await getWorkspaceState(this.context, "localCursorRulesToggles")) as ClineRulesToggles) || {}
const workflowToggles = ((await getWorkspaceState(this.context, "workflowToggles")) as ClineRulesToggles) || {}
const localWorkflowToggles = ((await getWorkspaceState(this.context, "workflowToggles")) as ClineRulesToggles) || {}
return {
version: this.context.extension?.packageJSON?.version ?? "",
@@ -1307,7 +1292,8 @@ export class Controller {
localClineRulesToggles: localClineRulesToggles || {},
localWindsurfRulesToggles: localWindsurfRulesToggles || {},
localCursorRulesToggles: localCursorRulesToggles || {},
workflowToggles: workflowToggles || {},
localWorkflowToggles: localWorkflowToggles || {},
globalWorkflowToggles: globalWorkflowToggles || {},
shellIntegrationTimeout,
isNewUser,
}
@@ -43,6 +43,8 @@ export async function refreshOpenRouterModels(
}
switch (rawModel.id) {
case "anthropic/claude-sonnet-4":
case "anthropic/claude-opus-4":
case "anthropic/claude-3-7-sonnet":
case "anthropic/claude-3-7-sonnet:beta":
case "anthropic/claude-3.7-sonnet":
@@ -44,6 +44,11 @@ export async function refreshRequestyModels(
models[model.id] = modelInfo
}
console.log("Requesty models fetched", models)
controller.postMessageToWebview({
type: "requestyModels",
requestyModels: models,
})
} else {
console.error("Invalid response from Requesty API")
}
+2
View File
@@ -8,6 +8,7 @@ import { resetState } from "./resetState"
import { subscribeToState } from "./subscribeToState"
import { toggleFavoriteModel } from "./toggleFavoriteModel"
import { togglePlanActMode } from "./togglePlanActMode"
import { updateAutoApprovalSettings } from "./updateAutoApprovalSettings"
import { updateTerminalConnectionTimeout } from "./updateTerminalConnectionTimeout"
// Streaming methods for this service
@@ -21,5 +22,6 @@ export function registerAllMethods(): void {
registerMethod("subscribeToState", subscribeToState, { isStreaming: true })
registerMethod("toggleFavoriteModel", toggleFavoriteModel)
registerMethod("togglePlanActMode", togglePlanActMode)
registerMethod("updateAutoApprovalSettings", updateAutoApprovalSettings)
registerMethod("updateTerminalConnectionTimeout", updateTerminalConnectionTimeout)
}
@@ -0,0 +1,32 @@
import { Controller } from ".."
import { AutoApprovalSettingsRequest } from "../../../shared/proto/state"
import { Empty } from "../../../shared/proto/common"
import { convertProtoToAutoApprovalSettings } from "../../../shared/proto-conversions/models/auto-approval-settings-conversion"
import { updateGlobalState } from "../../../core/storage/state"
/**
* Updates the auto approval settings
* @param controller The controller instance
* @param request The auto approval settings request
* @returns Empty response
*/
export async function updateAutoApprovalSettings(controller: Controller, request: AutoApprovalSettingsRequest): Promise<Empty> {
const currentSettings = (await controller.getStateToPostToWebview()).autoApprovalSettings
const incomingVersion = request.version
const currentVersion = currentSettings?.version ?? 1
// Only update if incoming version is higher
if (incomingVersion > currentVersion) {
const settings = convertProtoToAutoApprovalSettings(request)
await updateGlobalState(controller.context, "autoApprovalSettings", settings)
if (controller.task) {
controller.task.autoApprovalSettings = settings
}
await controller.postStateToWebview()
}
return Empty.create()
}
+2
View File
@@ -3,10 +3,12 @@
// Import all method implementations
import { registerMethod } from "./index"
import { onDidShowAnnouncement } from "./onDidShowAnnouncement"
import { scrollToSettings } from "./scrollToSettings"
// Register all ui service methods
export function registerAllMethods(): void {
// Register each method with the registry
registerMethod("onDidShowAnnouncement", onDidShowAnnouncement)
registerMethod("scrollToSettings", scrollToSettings)
}
@@ -0,0 +1,29 @@
import type { EmptyRequest, Boolean } from "../../../shared/proto/common"
import type { Controller } from "../index"
import { getGlobalState, updateGlobalState } from "../../storage/state"
/**
* Marks the current announcement as shown and returns the updated shouldShowAnnouncement value
*
* @param controller The controller instance
* @param _request The empty request (not used)
* @returns Boolean indicating whether an announcement should be shown
*/
export async function onDidShowAnnouncement(controller: Controller, _request: EmptyRequest): Promise<Boolean> {
try {
// Update the lastShownAnnouncementId to the current latestAnnouncementId
await updateGlobalState(controller.context, "lastShownAnnouncementId", controller.latestAnnouncementId)
// Get the updated lastShownAnnouncementId value after the update
const lastShownAnnouncementId = await getGlobalState(controller.context, "lastShownAnnouncementId")
// Calculate the new shouldShowAnnouncement value
// This replicates the same logic used in getStateToPostToWebview()
const shouldShowAnnouncement = lastShownAnnouncementId !== controller.latestAnnouncementId
return { value: shouldShowAnnouncement }
} catch (error) {
console.error("Failed to acknowledge announcement:", error)
return { value: false }
}
}
+16 -4
View File
@@ -8,7 +8,8 @@ import fs from "fs/promises"
*/
export async function parseSlashCommands(
text: string,
workflowToggles: ClineRulesToggles,
localWorkflowToggles: ClineRulesToggles,
globalWorkflowToggles: ClineRulesToggles,
): Promise<{ processedText: string; needsClinerulesFileCheck: boolean }> {
const SUPPORTED_DEFAULT_COMMANDS = ["newtask", "smol", "compact", "newrule", "reportbug"]
@@ -58,18 +59,29 @@ export async function parseSlashCommands(
return { processedText: processedText, needsClinerulesFileCheck: commandName === "newrule" ? true : false }
}
// in practice we want to minimize this work, so we only do it if theres a possible match
const enabledWorkflows = Object.entries(workflowToggles)
const globalWorkflows = Object.entries(globalWorkflowToggles)
.filter(([_, enabled]) => enabled)
.map(([filePath, _]) => {
const fileName = filePath.replace(/^.*[/\\]/, "")
return {
fullPath: filePath,
fileName: fileName,
}
})
const localWorkflows = Object.entries(localWorkflowToggles)
.filter(([_, enabled]) => enabled)
.map(([filePath, _]) => {
const fileName = filePath.replace(/^.*[/\\]/, "")
return {
fullPath: filePath,
fileName: fileName,
}
})
// local workflows have precedence over global workflows
const enabledWorkflows = [...localWorkflows, ...globalWorkflows]
// Then check if the command matches any enabled workflow filename
const matchingWorkflow = enabledWorkflows.find((workflow) => workflow.fileName === commandName)
+11
View File
@@ -76,6 +76,17 @@ export async function ensureRulesDirectoryExists(): Promise<string> {
return clineRulesDir
}
export async function ensureWorkflowsDirectoryExists(): Promise<string> {
const userDocumentsPath = await getDocumentsPath()
const clineWorkflowsDir = path.join(userDocumentsPath, "Cline", "Workflows")
try {
await fs.mkdir(clineWorkflowsDir, { recursive: true })
} catch (error) {
return path.join(os.homedir(), "Documents", "Cline", "Workflows") // in case creating a directory in documents fails for whatever reason (e.g. permissions) - this is fine because we will fail gracefully with a path that does not exist
}
return clineWorkflowsDir
}
export async function ensureMcpServersDirectoryExists(): Promise<string> {
const userDocumentsPath = await getDocumentsPath()
const mcpServersDir = path.join(userDocumentsPath, "Cline", "MCP")
+2
View File
@@ -19,6 +19,7 @@ export type SecretKey =
| "authNonce"
| "asksageApiKey"
| "xaiApiKey"
| "nebiusApiKey"
| "sambanovaApiKey"
export type GlobalStateKey =
@@ -54,6 +55,7 @@ export type GlobalStateKey =
| "openRouterProviderSorting"
| "autoApprovalSettings"
| "globalClineRulesToggles"
| "globalWorkflowToggles"
| "browserSettings"
| "chatSettings"
| "vsCodeLmModelSelector"
+9
View File
@@ -155,6 +155,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
thinkingBudgetTokens,
reasoningEffort,
sambanovaApiKey,
nebiusApiKey,
planActSeparateModelsSettingRaw,
favoritedModelIds,
globalClineRulesToggles,
@@ -162,6 +163,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
shellIntegrationTimeout,
enableCheckpointsSettingRaw,
mcpMarketplaceEnabledRaw,
globalWorkflowToggles,
] = await Promise.all([
getGlobalState(context, "isNewUser") as Promise<boolean | undefined>,
getGlobalState(context, "apiProvider") as Promise<ApiProvider | undefined>,
@@ -242,6 +244,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
getGlobalState(context, "thinkingBudgetTokens") as Promise<number | undefined>,
getGlobalState(context, "reasoningEffort") as Promise<string | undefined>,
getSecret(context, "sambanovaApiKey") as Promise<string | undefined>,
getSecret(context, "nebiusApiKey") as Promise<string | undefined>,
getGlobalState(context, "planActSeparateModelsSetting") as Promise<boolean | undefined>,
getGlobalState(context, "favoritedModelIds") as Promise<string[] | undefined>,
getGlobalState(context, "globalClineRulesToggles") as Promise<ClineRulesToggles | undefined>,
@@ -249,6 +252,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
getGlobalState(context, "shellIntegrationTimeout") as Promise<number | undefined>,
getGlobalState(context, "enableCheckpointsSetting") as Promise<boolean | undefined>,
getGlobalState(context, "mcpMarketplaceEnabled") as Promise<boolean | undefined>,
getGlobalState(context, "globalWorkflowToggles") as Promise<ClineRulesToggles | undefined>,
fetch,
])
@@ -353,6 +357,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
asksageApiUrl,
xaiApiKey,
sambanovaApiKey,
nebiusApiKey,
favoritedModelIds,
requestTimeoutMs,
},
@@ -382,6 +387,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
planActSeparateModelsSetting,
enableCheckpointsSetting: enableCheckpointsSetting,
shellIntegrationTimeout: shellIntegrationTimeout || 4000,
globalWorkflowToggles: globalWorkflowToggles || {},
}
}
@@ -445,6 +451,7 @@ export async function updateApiConfiguration(context: vscode.ExtensionContext, a
reasoningEffort,
clineApiKey,
sambanovaApiKey,
nebiusApiKey,
favoritedModelIds,
} = apiConfiguration
await updateGlobalState(context, "apiProvider", apiProvider)
@@ -505,6 +512,7 @@ export async function updateApiConfiguration(context: vscode.ExtensionContext, a
await updateGlobalState(context, "reasoningEffort", reasoningEffort)
await storeSecret(context, "clineApiKey", clineApiKey)
await storeSecret(context, "sambanovaApiKey", sambanovaApiKey)
await storeSecret(context, "nebiusApiKey", nebiusApiKey)
await updateGlobalState(context, "favoritedModelIds", favoritedModelIds)
await updateGlobalState(context, "requestTimeoutMs", apiConfiguration.requestTimeoutMs)
}
@@ -534,6 +542,7 @@ export async function resetExtensionState(context: vscode.ExtensionContext) {
"asksageApiKey",
"xaiApiKey",
"sambanovaApiKey",
"nebiusApiKey",
]
for (const key of secretKeys) {
await storeSecret(context, key, undefined)
+3 -2
View File
@@ -4117,7 +4117,7 @@ export class Task {
// Track if we need to check clinerulesFile
let needsClinerulesFileCheck = false
const workflowToggles = await refreshWorkflowToggles(this.getContext(), cwd)
const { localWorkflowToggles, globalWorkflowToggles } = await refreshWorkflowToggles(this.getContext(), cwd)
const processUserContent = async () => {
// This is a temporary solution to dynamically load context mentions from tool results. It checks for the presence of tags that indicate that the tool was rejected and feedback was provided (see formatToolDeniedFeedback, attemptCompletion, executeCommand, and consecutiveMistakeCount >= 3) or "<answer>" (see askFollowupQuestion), we place all user generated content in these tags so they can effectively be used as markers for when we should parse mentions). However if we allow multiple tools responses in the future, we will need to parse mentions specifically within the user content tags.
@@ -4143,7 +4143,8 @@ export class Task {
// when parsing slash commands, we still want to allow the user to provide their desired context
const { processedText, needsClinerulesFileCheck: needsCheck } = await parseSlashCommands(
parsedText,
workflowToggles,
localWorkflowToggles,
globalWorkflowToggles,
)
if (needsCheck) {
+1 -21
View File
@@ -150,27 +150,7 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
this.outputChannel.appendLine("Webview view resolved")
// Set the title to include the keyboard shortcut
if (this.view && "title" in this.view) {
// Check if the view object has a title property
const isMac = process.platform === "darwin"
const shortcutDisplay = isMac ? " (⌘+')" : " (Ctrl+')"
const baseTitle = this.context.extension.packageJSON.displayName || "Cline"
const newTitleWithShortcut = `${baseTitle}${shortcutDisplay}`
const currentTitle = this.view.title
if (typeof currentTitle === "string") {
if (!currentTitle.includes(shortcutDisplay)) {
// Title exists and is a string, but doesn't have the shortcut
this.view.title = newTitleWithShortcut
}
// If it includes shortcutDisplay, do nothing
} else {
// Title is undefined or not a string (e.g., for sidebar initially)
this.view.title = newTitleWithShortcut
}
}
// Title setting logic removed to allow VSCode to use the container title primarily.
}
}
+26 -8
View File
@@ -30,6 +30,7 @@ import { arePathsEqual } from "@utils/path"
import { secondsToMs } from "@utils/time"
import { GlobalFileNames } from "@core/storage/disk"
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { ExtensionMessage } from "@shared/ExtensionMessage"
// Default timeout for internal MCP data requests in milliseconds; is not the same as the user facing timeout stored as DEFAULT_MCP_TIMEOUT_SECONDS
@@ -38,10 +39,10 @@ const DEFAULT_REQUEST_TIMEOUT_MS = 5000
export type McpConnection = {
server: McpServer
client: Client
transport: StdioClientTransport | SSEClientTransport
transport: StdioClientTransport | SSEClientTransport | StreamableHTTPClientTransport
}
export type McpTransportType = "stdio" | "sse"
export type McpTransportType = "stdio" | "sse" | "http"
export type McpServerConfig = z.infer<typeof ServerConfigSchema>
@@ -69,7 +70,15 @@ const StdioConfigSchema = BaseConfigSchema.extend({
transportType: "stdio" as const,
}))
const ServerConfigSchema = z.union([StdioConfigSchema, SseConfigSchema])
const StreamableHTTPConfigSchema = BaseConfigSchema.extend({
transportType: z.literal("http"),
url: z.string().url(),
}).transform((config) => ({
...config,
transportType: "http" as const,
}))
const ServerConfigSchema = z.union([StdioConfigSchema, SseConfigSchema, StreamableHTTPConfigSchema])
const McpSettingsSchema = z.object({
mcpServers: z.record(ServerConfigSchema),
@@ -183,7 +192,7 @@ export class McpHub {
private async connectToServerRPC(
name: string,
config: z.infer<typeof StdioConfigSchema> | z.infer<typeof SseConfigSchema>,
config: z.infer<typeof StdioConfigSchema> | z.infer<typeof SseConfigSchema> | z.infer<typeof StreamableHTTPConfigSchema>,
): Promise<void> {
// Remove existing connection if it exists (should never happen, the connection should be deleted beforehand)
this.connections = this.connections.filter((conn) => conn.server.name !== name)
@@ -200,10 +209,12 @@ export class McpHub {
},
)
let transport: StdioClientTransport | SSEClientTransport
let transport: StdioClientTransport | SSEClientTransport | StreamableHTTPClientTransport
if (config.transportType === "sse") {
transport = new SSEClientTransport(new URL(config.url), {})
} else if (config.transportType === "http") {
transport = new StreamableHTTPClientTransport(new URL(config.url), {})
} else {
transport = new StdioClientTransport({
command: config.command,
@@ -297,7 +308,7 @@ export class McpHub {
private async connectToServer(
name: string,
config: z.infer<typeof StdioConfigSchema> | z.infer<typeof SseConfigSchema>,
config: z.infer<typeof StdioConfigSchema> | z.infer<typeof SseConfigSchema> | z.infer<typeof StreamableHTTPConfigSchema>,
): Promise<void> {
// Remove existing connection if it exists (should never happen, the connection should be deleted beforehand)
this.connections = this.connections.filter((conn) => conn.server.name !== name)
@@ -314,10 +325,12 @@ export class McpHub {
},
)
let transport: StdioClientTransport | SSEClientTransport
let transport: StdioClientTransport | SSEClientTransport | StreamableHTTPClientTransport
if (config.transportType === "sse") {
transport = new SSEClientTransport(new URL(config.url), {})
} else if (config.transportType === "http") {
transport = new StreamableHTTPClientTransport(new URL(config.url), {})
} else {
transport = new StdioClientTransport({
command: config.command,
@@ -778,7 +791,7 @@ export class McpHub {
console.error(`Failed to parse timeout configuration for server ${serverName}: ${error}`)
}
return await connection.client.request(
const result = await connection.client.request(
{
method: "tools/call",
params: {
@@ -791,6 +804,11 @@ export class McpHub {
timeout,
},
)
return {
...result,
content: result.content ?? [],
}
}
/**
+2 -1
View File
@@ -140,7 +140,8 @@ export interface ExtensionState {
vscMachineId: string
globalClineRulesToggles: ClineRulesToggles
localClineRulesToggles: ClineRulesToggles
workflowToggles: ClineRulesToggles
localWorkflowToggles: ClineRulesToggles
globalWorkflowToggles: ClineRulesToggles
localCursorRulesToggles: ClineRulesToggles
localWindsurfRulesToggles: ClineRulesToggles
}
-6
View File
@@ -1,5 +1,4 @@
import { ApiConfiguration } from "./api"
import { AutoApprovalSettings } from "./AutoApprovalSettings"
import { BrowserSettings } from "./BrowserSettings"
import { ChatSettings } from "./ChatSettings"
import { UserInfo } from "./UserInfo"
@@ -14,13 +13,9 @@ export interface WebviewMessage {
| "newTask"
| "condense"
| "reportBug"
| "didShowAnnouncement"
| "openInBrowser"
| "showChatView"
| "refreshClineRules"
| "openMcpSettings"
| "autoApprovalSettings"
| "togglePlanActMode"
| "openExtensionSettings"
| "requestVsCodeLmModels"
| "showAccountViewClicked"
@@ -47,7 +42,6 @@ export interface WebviewMessage {
images?: string[]
bool?: boolean
number?: number
autoApprovalSettings?: AutoApprovalSettings
browserSettings?: BrowserSettings
chatSettings?: ChatSettings
chatContent?: ChatContent
+164 -6
View File
@@ -19,6 +19,7 @@ export type ApiProvider =
| "vscode-lm"
| "cline"
| "litellm"
| "nebius"
| "fireworks"
| "asksage"
| "xai"
@@ -81,6 +82,7 @@ export interface ApiHandlerOptions {
azureApiVersion?: string
vsCodeLmModelSelector?: LanguageModelChatSelector
qwenApiLine?: string
nebiusApiKey?: string
asksageApiUrl?: string
asksageApiKey?: string
xaiApiKey?: string
@@ -136,8 +138,29 @@ export interface OpenAiCompatibleModelInfo extends ModelInfo {
// Anthropic
// https://docs.anthropic.com/en/docs/about-claude/models // prices updated 2025-01-02
export type AnthropicModelId = keyof typeof anthropicModels
export const anthropicDefaultModelId: AnthropicModelId = "claude-3-7-sonnet-20250219"
export const anthropicDefaultModelId: AnthropicModelId = "claude-sonnet-4-20250514"
export const anthropicModels = {
"claude-sonnet-4-20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
},
"claude-opus-4-20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"claude-3-7-sonnet-20250219": {
maxTokens: 8192,
contextWindow: 200_000,
@@ -195,8 +218,28 @@ export const anthropicModels = {
// AWS Bedrock
// https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html
export type BedrockModelId = keyof typeof bedrockModels
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-3-7-sonnet-20250219-v1:0"
export const bedrockDefaultModelId: BedrockModelId = "anthropic.claude-sonnet-4-20250514-v1:0"
export const bedrockModels = {
"anthropic.claude-sonnet-4-20250514-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
},
"anthropic.claude-opus-4-20250514-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"amazon.nova-premier-v1:0": {
maxTokens: 10_000,
contextWindow: 1_000_000,
@@ -315,7 +358,7 @@ export const bedrockModels = {
// OpenRouter
// https://openrouter.ai/models?order=newest&supported_parameters=tools
export const openRouterDefaultModelId = "anthropic/claude-3.7-sonnet" // will always exist in openRouterModels
export const openRouterDefaultModelId = "anthropic/claude-sonnet-4" // will always exist in openRouterModels
export const openRouterDefaultModelInfo: ModelInfo = {
maxTokens: 8192,
contextWindow: 200_000,
@@ -327,14 +370,34 @@ export const openRouterDefaultModelInfo: ModelInfo = {
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
description:
"Claude 3.7 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities. It introduces a hybrid reasoning approach, allowing users to choose between rapid responses and extended, step-by-step processing for complex tasks. The model demonstrates notable improvements in coding, particularly in front-end development and full-stack updates, and excels in agentic workflows, where it can autonomously navigate multi-step processes. \n\nClaude 3.7 Sonnet maintains performance parity with its predecessor in standard mode while offering an extended reasoning mode for enhanced accuracy in math, coding, and instruction-following tasks.\n\nRead more at the [blog post here](https://www.anthropic.com/news/claude-3-7-sonnet)",
"Claude 4 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities. It introduces a hybrid reasoning approach, allowing users to choose between rapid responses and extended, step-by-step processing for complex tasks. The model demonstrates notable improvements in coding, particularly in front-end development and full-stack updates, and excels in agentic workflows, where it can autonomously navigate multi-step processes. \n\nClaude 4 Sonnet maintains performance parity with its predecessor in standard mode while offering an extended reasoning mode for enhanced accuracy in math, coding, and instruction-following tasks.\n\nRead more at the [blog post here](https://www.anthropic.com/news/claude-4)",
}
// Vertex AI
// https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude
// https://cloud.google.com/vertex-ai/generative-ai/pricing#partner-models
export type VertexModelId = keyof typeof vertexModels
export const vertexDefaultModelId: VertexModelId = "claude-3-7-sonnet@20250219"
export const vertexDefaultModelId: VertexModelId = "claude-sonnet-4@20250514"
export const vertexModels = {
"claude-sonnet-4@20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
},
"claude-opus-4@20250514": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
},
"claude-3-7-sonnet@20250219": {
maxTokens: 8192,
contextWindow: 200_000,
@@ -1392,7 +1455,7 @@ export const doubaoModels = {
// Mistral
// https://docs.mistral.ai/getting-started/models/models_overview/
export type MistralModelId = keyof typeof mistralModels
export const mistralDefaultModelId: MistralModelId = "codestral-2501"
export const mistralDefaultModelId: MistralModelId = "devstral-small-2505"
export const mistralModels = {
"mistral-large-2411": {
maxTokens: 131_000,
@@ -1482,6 +1545,14 @@ export const mistralModels = {
inputPrice: 0.3,
outputPrice: 0.9,
},
"devstral-small-2505": {
maxTokens: 128_000,
contextWindow: 131_072,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.1,
outputPrice: 0.3,
},
} as const satisfies Record<string, ModelInfo>
// LiteLLM
@@ -1552,6 +1623,93 @@ export const askSageModels = {
},
}
// Nebius AI Studio
// https://docs.nebius.com/studio/inference/models
export const nebiusModels = {
"deepseek-ai/DeepSeek-V3": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.5,
outputPrice: 1.5,
},
"deepseek-ai/DeepSeek-V3-0324-fast": {
maxTokens: 128_000,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 2,
outputPrice: 6,
},
"deepseek-ai/DeepSeek-R1": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.8,
outputPrice: 2.4,
},
"deepseek-ai/DeepSeek-R1-fast": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 2,
outputPrice: 6,
},
"meta-llama/Llama-3.3-70B-Instruct-fast": {
maxTokens: 32_000,
contextWindow: 96_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.25,
outputPrice: 0.75,
},
"Qwen/Qwen2.5-32B-Instruct-fast": {
maxTokens: 8_192,
contextWindow: 32_768,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.13,
outputPrice: 0.4,
},
"Qwen/Qwen2.5-Coder-32B-Instruct-fast": {
maxTokens: 128_000,
contextWindow: 128_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.1,
outputPrice: 0.3,
},
"Qwen/Qwen3-4B-fast": {
maxTokens: 32_000,
contextWindow: 41_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.08,
outputPrice: 0.24,
},
"Qwen/Qwen3-30B-A3B-fast": {
maxTokens: 32_000,
contextWindow: 41_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.3,
outputPrice: 0.9,
},
"Qwen/Qwen3-235B-A22B": {
maxTokens: 32_000,
contextWindow: 41_000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.2,
outputPrice: 0.6,
},
} as const satisfies Record<string, ModelInfo>
export type NebiusModelId = keyof typeof nebiusModels
export const nebiusDefaultModelId = "Qwen/Qwen2.5-32B-Instruct-fast" satisfies NebiusModelId
// X AI
// https://docs.x.ai/docs/api-reference
export type XAIModelId = keyof typeof xaiModels
@@ -0,0 +1,45 @@
import { AutoApprovalSettings } from "../../AutoApprovalSettings"
import { AutoApprovalSettingsRequest } from "../../proto/state"
// Converts domain AutoApprovalSettings to proto AutoApprovalSettingsRequest
export function convertAutoApprovalSettingsToProto(settings: AutoApprovalSettings): AutoApprovalSettingsRequest {
return {
metadata: {},
version: settings.version,
enabled: settings.enabled,
actions: {
readFiles: settings.actions.readFiles || false,
readFilesExternally: settings.actions.readFilesExternally || false,
editFiles: settings.actions.editFiles || false,
editFilesExternally: settings.actions.editFilesExternally || false,
executeSafeCommands: settings.actions.executeSafeCommands || false,
executeAllCommands: settings.actions.executeAllCommands || false,
useBrowser: settings.actions.useBrowser || false,
useMcp: settings.actions.useMcp || false,
},
maxRequests: settings.maxRequests || 20,
enableNotifications: settings.enableNotifications || false,
favorites: settings.favorites || [],
}
}
// Converts proto AutoApprovalSettingsRequest to domain AutoApprovalSettings
export function convertProtoToAutoApprovalSettings(protoSettings: AutoApprovalSettingsRequest): AutoApprovalSettings {
return {
version: protoSettings.version,
enabled: protoSettings.enabled,
actions: {
readFiles: protoSettings.actions?.readFiles || false,
readFilesExternally: protoSettings.actions?.readFilesExternally || false,
editFiles: protoSettings.actions?.editFiles || false,
editFilesExternally: protoSettings.actions?.editFilesExternally || false,
executeSafeCommands: protoSettings.actions?.executeSafeCommands || false,
executeAllCommands: protoSettings.actions?.executeAllCommands || false,
useBrowser: protoSettings.actions?.useBrowser || false,
useMcp: protoSettings.actions?.useMcp || false,
},
maxRequests: protoSettings.maxRequests || 20,
enableNotifications: protoSettings.enableNotifications || false,
favorites: protoSettings.favorites || [],
}
}
+171
View File
@@ -10,6 +10,15 @@ import { Empty, EmptyRequest, Metadata, StringArray, StringRequest } from "./com
export const protobufPackage = "cline"
/** Response for refreshRules operation */
export interface RefreshedRules {
globalClineRulesToggles?: ClineRulesToggles | undefined
localClineRulesToggles?: ClineRulesToggles | undefined
localCursorRulesToggles?: ClineRulesToggles | undefined
localWindsurfRulesToggles?: ClineRulesToggles | undefined
workflowToggles?: ClineRulesToggles | undefined
}
/** Request to toggle a Windsurf rule */
export interface ToggleWindsurfRuleRequest {
metadata?: Metadata | undefined
@@ -132,6 +141,159 @@ export interface ToggleCursorRuleRequest {
enabled: boolean
}
function createBaseRefreshedRules(): RefreshedRules {
return {
globalClineRulesToggles: undefined,
localClineRulesToggles: undefined,
localCursorRulesToggles: undefined,
localWindsurfRulesToggles: undefined,
workflowToggles: undefined,
}
}
export const RefreshedRules: MessageFns<RefreshedRules> = {
encode(message: RefreshedRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.globalClineRulesToggles !== undefined) {
ClineRulesToggles.encode(message.globalClineRulesToggles, writer.uint32(10).fork()).join()
}
if (message.localClineRulesToggles !== undefined) {
ClineRulesToggles.encode(message.localClineRulesToggles, writer.uint32(18).fork()).join()
}
if (message.localCursorRulesToggles !== undefined) {
ClineRulesToggles.encode(message.localCursorRulesToggles, writer.uint32(26).fork()).join()
}
if (message.localWindsurfRulesToggles !== undefined) {
ClineRulesToggles.encode(message.localWindsurfRulesToggles, writer.uint32(34).fork()).join()
}
if (message.workflowToggles !== undefined) {
ClineRulesToggles.encode(message.workflowToggles, writer.uint32(42).fork()).join()
}
return writer
},
decode(input: BinaryReader | Uint8Array, length?: number): RefreshedRules {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input)
let end = length === undefined ? reader.len : reader.pos + length
const message = createBaseRefreshedRules()
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break
}
message.globalClineRulesToggles = ClineRulesToggles.decode(reader, reader.uint32())
continue
}
case 2: {
if (tag !== 18) {
break
}
message.localClineRulesToggles = ClineRulesToggles.decode(reader, reader.uint32())
continue
}
case 3: {
if (tag !== 26) {
break
}
message.localCursorRulesToggles = ClineRulesToggles.decode(reader, reader.uint32())
continue
}
case 4: {
if (tag !== 34) {
break
}
message.localWindsurfRulesToggles = ClineRulesToggles.decode(reader, reader.uint32())
continue
}
case 5: {
if (tag !== 42) {
break
}
message.workflowToggles = ClineRulesToggles.decode(reader, reader.uint32())
continue
}
}
if ((tag & 7) === 4 || tag === 0) {
break
}
reader.skip(tag & 7)
}
return message
},
fromJSON(object: any): RefreshedRules {
return {
globalClineRulesToggles: isSet(object.globalClineRulesToggles)
? ClineRulesToggles.fromJSON(object.globalClineRulesToggles)
: undefined,
localClineRulesToggles: isSet(object.localClineRulesToggles)
? ClineRulesToggles.fromJSON(object.localClineRulesToggles)
: undefined,
localCursorRulesToggles: isSet(object.localCursorRulesToggles)
? ClineRulesToggles.fromJSON(object.localCursorRulesToggles)
: undefined,
localWindsurfRulesToggles: isSet(object.localWindsurfRulesToggles)
? ClineRulesToggles.fromJSON(object.localWindsurfRulesToggles)
: undefined,
workflowToggles: isSet(object.workflowToggles) ? ClineRulesToggles.fromJSON(object.workflowToggles) : undefined,
}
},
toJSON(message: RefreshedRules): unknown {
const obj: any = {}
if (message.globalClineRulesToggles !== undefined) {
obj.globalClineRulesToggles = ClineRulesToggles.toJSON(message.globalClineRulesToggles)
}
if (message.localClineRulesToggles !== undefined) {
obj.localClineRulesToggles = ClineRulesToggles.toJSON(message.localClineRulesToggles)
}
if (message.localCursorRulesToggles !== undefined) {
obj.localCursorRulesToggles = ClineRulesToggles.toJSON(message.localCursorRulesToggles)
}
if (message.localWindsurfRulesToggles !== undefined) {
obj.localWindsurfRulesToggles = ClineRulesToggles.toJSON(message.localWindsurfRulesToggles)
}
if (message.workflowToggles !== undefined) {
obj.workflowToggles = ClineRulesToggles.toJSON(message.workflowToggles)
}
return obj
},
create<I extends Exact<DeepPartial<RefreshedRules>, I>>(base?: I): RefreshedRules {
return RefreshedRules.fromPartial(base ?? ({} as any))
},
fromPartial<I extends Exact<DeepPartial<RefreshedRules>, I>>(object: I): RefreshedRules {
const message = createBaseRefreshedRules()
message.globalClineRulesToggles =
object.globalClineRulesToggles !== undefined && object.globalClineRulesToggles !== null
? ClineRulesToggles.fromPartial(object.globalClineRulesToggles)
: undefined
message.localClineRulesToggles =
object.localClineRulesToggles !== undefined && object.localClineRulesToggles !== null
? ClineRulesToggles.fromPartial(object.localClineRulesToggles)
: undefined
message.localCursorRulesToggles =
object.localCursorRulesToggles !== undefined && object.localCursorRulesToggles !== null
? ClineRulesToggles.fromPartial(object.localCursorRulesToggles)
: undefined
message.localWindsurfRulesToggles =
object.localWindsurfRulesToggles !== undefined && object.localWindsurfRulesToggles !== null
? ClineRulesToggles.fromPartial(object.localWindsurfRulesToggles)
: undefined
message.workflowToggles =
object.workflowToggles !== undefined && object.workflowToggles !== null
? ClineRulesToggles.fromPartial(object.workflowToggles)
: undefined
return message
},
}
function createBaseToggleWindsurfRuleRequest(): ToggleWindsurfRuleRequest {
return { metadata: undefined, rulePath: "", enabled: false }
}
@@ -1604,6 +1766,15 @@ export const FileServiceDefinition = {
responseStream: false,
options: {},
},
/** Refreshes all rule toggles (Cline, External, and Workflows) */
refreshRules: {
name: "refreshRules",
requestType: EmptyRequest,
requestStream: false,
responseType: RefreshedRules,
responseStream: false,
options: {},
},
},
} as const
+381
View File
@@ -64,6 +64,28 @@ export interface ChatContent {
images: string[]
}
/** Message for auto approval settings */
export interface AutoApprovalSettingsRequest {
metadata?: Metadata | undefined
version: number
enabled: boolean
actions?: AutoApprovalSettingsRequest_Actions | undefined
maxRequests: number
enableNotifications: boolean
favorites: string[]
}
export interface AutoApprovalSettingsRequest_Actions {
readFiles: boolean
readFilesExternally: boolean
editFiles: boolean
editFilesExternally: boolean
executeSafeCommands: boolean
executeAllCommands: boolean
useBrowser: boolean
useMcp: boolean
}
function createBaseState(): State {
return { stateJson: "" }
}
@@ -391,6 +413,357 @@ export const ChatContent: MessageFns<ChatContent> = {
},
}
function createBaseAutoApprovalSettingsRequest(): AutoApprovalSettingsRequest {
return {
metadata: undefined,
version: 0,
enabled: false,
actions: undefined,
maxRequests: 0,
enableNotifications: false,
favorites: [],
}
}
export const AutoApprovalSettingsRequest: MessageFns<AutoApprovalSettingsRequest> = {
encode(message: AutoApprovalSettingsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.metadata !== undefined) {
Metadata.encode(message.metadata, writer.uint32(10).fork()).join()
}
if (message.version !== 0) {
writer.uint32(16).int32(message.version)
}
if (message.enabled !== false) {
writer.uint32(24).bool(message.enabled)
}
if (message.actions !== undefined) {
AutoApprovalSettingsRequest_Actions.encode(message.actions, writer.uint32(34).fork()).join()
}
if (message.maxRequests !== 0) {
writer.uint32(40).int32(message.maxRequests)
}
if (message.enableNotifications !== false) {
writer.uint32(48).bool(message.enableNotifications)
}
for (const v of message.favorites) {
writer.uint32(58).string(v!)
}
return writer
},
decode(input: BinaryReader | Uint8Array, length?: number): AutoApprovalSettingsRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input)
let end = length === undefined ? reader.len : reader.pos + length
const message = createBaseAutoApprovalSettingsRequest()
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break
}
message.metadata = Metadata.decode(reader, reader.uint32())
continue
}
case 2: {
if (tag !== 16) {
break
}
message.version = reader.int32()
continue
}
case 3: {
if (tag !== 24) {
break
}
message.enabled = reader.bool()
continue
}
case 4: {
if (tag !== 34) {
break
}
message.actions = AutoApprovalSettingsRequest_Actions.decode(reader, reader.uint32())
continue
}
case 5: {
if (tag !== 40) {
break
}
message.maxRequests = reader.int32()
continue
}
case 6: {
if (tag !== 48) {
break
}
message.enableNotifications = reader.bool()
continue
}
case 7: {
if (tag !== 58) {
break
}
message.favorites.push(reader.string())
continue
}
}
if ((tag & 7) === 4 || tag === 0) {
break
}
reader.skip(tag & 7)
}
return message
},
fromJSON(object: any): AutoApprovalSettingsRequest {
return {
metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined,
version: isSet(object.version) ? globalThis.Number(object.version) : 0,
enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
actions: isSet(object.actions) ? AutoApprovalSettingsRequest_Actions.fromJSON(object.actions) : undefined,
maxRequests: isSet(object.maxRequests) ? globalThis.Number(object.maxRequests) : 0,
enableNotifications: isSet(object.enableNotifications) ? globalThis.Boolean(object.enableNotifications) : false,
favorites: globalThis.Array.isArray(object?.favorites) ? object.favorites.map((e: any) => globalThis.String(e)) : [],
}
},
toJSON(message: AutoApprovalSettingsRequest): unknown {
const obj: any = {}
if (message.metadata !== undefined) {
obj.metadata = Metadata.toJSON(message.metadata)
}
if (message.version !== 0) {
obj.version = Math.round(message.version)
}
if (message.enabled !== false) {
obj.enabled = message.enabled
}
if (message.actions !== undefined) {
obj.actions = AutoApprovalSettingsRequest_Actions.toJSON(message.actions)
}
if (message.maxRequests !== 0) {
obj.maxRequests = Math.round(message.maxRequests)
}
if (message.enableNotifications !== false) {
obj.enableNotifications = message.enableNotifications
}
if (message.favorites?.length) {
obj.favorites = message.favorites
}
return obj
},
create<I extends Exact<DeepPartial<AutoApprovalSettingsRequest>, I>>(base?: I): AutoApprovalSettingsRequest {
return AutoApprovalSettingsRequest.fromPartial(base ?? ({} as any))
},
fromPartial<I extends Exact<DeepPartial<AutoApprovalSettingsRequest>, I>>(object: I): AutoApprovalSettingsRequest {
const message = createBaseAutoApprovalSettingsRequest()
message.metadata =
object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined
message.version = object.version ?? 0
message.enabled = object.enabled ?? false
message.actions =
object.actions !== undefined && object.actions !== null
? AutoApprovalSettingsRequest_Actions.fromPartial(object.actions)
: undefined
message.maxRequests = object.maxRequests ?? 0
message.enableNotifications = object.enableNotifications ?? false
message.favorites = object.favorites?.map((e) => e) || []
return message
},
}
function createBaseAutoApprovalSettingsRequest_Actions(): AutoApprovalSettingsRequest_Actions {
return {
readFiles: false,
readFilesExternally: false,
editFiles: false,
editFilesExternally: false,
executeSafeCommands: false,
executeAllCommands: false,
useBrowser: false,
useMcp: false,
}
}
export const AutoApprovalSettingsRequest_Actions: MessageFns<AutoApprovalSettingsRequest_Actions> = {
encode(message: AutoApprovalSettingsRequest_Actions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.readFiles !== false) {
writer.uint32(8).bool(message.readFiles)
}
if (message.readFilesExternally !== false) {
writer.uint32(16).bool(message.readFilesExternally)
}
if (message.editFiles !== false) {
writer.uint32(24).bool(message.editFiles)
}
if (message.editFilesExternally !== false) {
writer.uint32(32).bool(message.editFilesExternally)
}
if (message.executeSafeCommands !== false) {
writer.uint32(40).bool(message.executeSafeCommands)
}
if (message.executeAllCommands !== false) {
writer.uint32(48).bool(message.executeAllCommands)
}
if (message.useBrowser !== false) {
writer.uint32(56).bool(message.useBrowser)
}
if (message.useMcp !== false) {
writer.uint32(64).bool(message.useMcp)
}
return writer
},
decode(input: BinaryReader | Uint8Array, length?: number): AutoApprovalSettingsRequest_Actions {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input)
let end = length === undefined ? reader.len : reader.pos + length
const message = createBaseAutoApprovalSettingsRequest_Actions()
while (reader.pos < end) {
const tag = reader.uint32()
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break
}
message.readFiles = reader.bool()
continue
}
case 2: {
if (tag !== 16) {
break
}
message.readFilesExternally = reader.bool()
continue
}
case 3: {
if (tag !== 24) {
break
}
message.editFiles = reader.bool()
continue
}
case 4: {
if (tag !== 32) {
break
}
message.editFilesExternally = reader.bool()
continue
}
case 5: {
if (tag !== 40) {
break
}
message.executeSafeCommands = reader.bool()
continue
}
case 6: {
if (tag !== 48) {
break
}
message.executeAllCommands = reader.bool()
continue
}
case 7: {
if (tag !== 56) {
break
}
message.useBrowser = reader.bool()
continue
}
case 8: {
if (tag !== 64) {
break
}
message.useMcp = reader.bool()
continue
}
}
if ((tag & 7) === 4 || tag === 0) {
break
}
reader.skip(tag & 7)
}
return message
},
fromJSON(object: any): AutoApprovalSettingsRequest_Actions {
return {
readFiles: isSet(object.readFiles) ? globalThis.Boolean(object.readFiles) : false,
readFilesExternally: isSet(object.readFilesExternally) ? globalThis.Boolean(object.readFilesExternally) : false,
editFiles: isSet(object.editFiles) ? globalThis.Boolean(object.editFiles) : false,
editFilesExternally: isSet(object.editFilesExternally) ? globalThis.Boolean(object.editFilesExternally) : false,
executeSafeCommands: isSet(object.executeSafeCommands) ? globalThis.Boolean(object.executeSafeCommands) : false,
executeAllCommands: isSet(object.executeAllCommands) ? globalThis.Boolean(object.executeAllCommands) : false,
useBrowser: isSet(object.useBrowser) ? globalThis.Boolean(object.useBrowser) : false,
useMcp: isSet(object.useMcp) ? globalThis.Boolean(object.useMcp) : false,
}
},
toJSON(message: AutoApprovalSettingsRequest_Actions): unknown {
const obj: any = {}
if (message.readFiles !== false) {
obj.readFiles = message.readFiles
}
if (message.readFilesExternally !== false) {
obj.readFilesExternally = message.readFilesExternally
}
if (message.editFiles !== false) {
obj.editFiles = message.editFiles
}
if (message.editFilesExternally !== false) {
obj.editFilesExternally = message.editFilesExternally
}
if (message.executeSafeCommands !== false) {
obj.executeSafeCommands = message.executeSafeCommands
}
if (message.executeAllCommands !== false) {
obj.executeAllCommands = message.executeAllCommands
}
if (message.useBrowser !== false) {
obj.useBrowser = message.useBrowser
}
if (message.useMcp !== false) {
obj.useMcp = message.useMcp
}
return obj
},
create<I extends Exact<DeepPartial<AutoApprovalSettingsRequest_Actions>, I>>(base?: I): AutoApprovalSettingsRequest_Actions {
return AutoApprovalSettingsRequest_Actions.fromPartial(base ?? ({} as any))
},
fromPartial<I extends Exact<DeepPartial<AutoApprovalSettingsRequest_Actions>, I>>(
object: I,
): AutoApprovalSettingsRequest_Actions {
const message = createBaseAutoApprovalSettingsRequest_Actions()
message.readFiles = object.readFiles ?? false
message.readFilesExternally = object.readFilesExternally ?? false
message.editFiles = object.editFiles ?? false
message.editFilesExternally = object.editFilesExternally ?? false
message.executeSafeCommands = object.executeSafeCommands ?? false
message.executeAllCommands = object.executeAllCommands ?? false
message.useBrowser = object.useBrowser ?? false
message.useMcp = object.useMcp ?? false
return message
},
}
export type StateServiceDefinition = typeof StateServiceDefinition
export const StateServiceDefinition = {
name: "StateService",
@@ -444,6 +817,14 @@ export const StateServiceDefinition = {
responseStream: false,
options: {},
},
updateAutoApprovalSettings: {
name: "updateAutoApprovalSettings",
requestType: AutoApprovalSettingsRequest,
requestStream: false,
responseType: Empty,
responseStream: false,
options: {},
},
},
} as const
+10 -1
View File
@@ -5,7 +5,7 @@
// source: ui.proto
/* eslint-disable */
import { Empty, StringRequest } from "./common"
import { Boolean, Empty, EmptyRequest, StringRequest } from "./common"
export const protobufPackage = "cline"
@@ -24,5 +24,14 @@ export const UiServiceDefinition = {
responseStream: false,
options: {},
},
/** Marks the current announcement as shown and returns whether an announcement should still be shown */
onDidShowAnnouncement: {
name: "onDidShowAnnouncement",
requestType: EmptyRequest,
requestStream: false,
responseType: Boolean,
responseStream: false,
options: {},
},
},
} as const
+6
View File
@@ -34,6 +34,7 @@ import { searchFiles } from "../core/controller/file/searchFiles"
import { toggleClineRule } from "../core/controller/file/toggleClineRule"
import { toggleCursorRule } from "../core/controller/file/toggleCursorRule"
import { toggleWindsurfRule } from "../core/controller/file/toggleWindsurfRule"
import { refreshRules } from "../core/controller/file/refreshRules"
// Mcp Service
import { toggleMcpServer } from "../core/controller/mcp/toggleMcpServer"
@@ -64,6 +65,7 @@ import { toggleFavoriteModel } from "../core/controller/state/toggleFavoriteMode
import { resetState } from "../core/controller/state/resetState"
import { togglePlanActMode } from "../core/controller/state/togglePlanActMode"
import { updateTerminalConnectionTimeout } from "../core/controller/state/updateTerminalConnectionTimeout"
import { updateAutoApprovalSettings } from "../core/controller/state/updateAutoApprovalSettings"
// Task Service
import { cancelTask } from "../core/controller/task/cancelTask"
@@ -81,6 +83,7 @@ import { taskCompletionViewChanges } from "../core/controller/task/taskCompletio
// Ui Service
import { scrollToSettings } from "../core/controller/ui/scrollToSettings"
import { onDidShowAnnouncement } from "../core/controller/ui/onDidShowAnnouncement"
// Web Service
import { checkIsImageUrl } from "../core/controller/web/checkIsImageUrl"
@@ -130,6 +133,7 @@ export function addServices(
toggleClineRule: wrapper(toggleClineRule, controller),
toggleCursorRule: wrapper(toggleCursorRule, controller),
toggleWindsurfRule: wrapper(toggleWindsurfRule, controller),
refreshRules: wrapper(refreshRules, controller),
})
// Mcp Service
@@ -168,6 +172,7 @@ export function addServices(
resetState: wrapper(resetState, controller),
togglePlanActMode: wrapper(togglePlanActMode, controller),
updateTerminalConnectionTimeout: wrapper(updateTerminalConnectionTimeout, controller),
updateAutoApprovalSettings: wrapper(updateAutoApprovalSettings, controller),
})
// Task Service
@@ -189,6 +194,7 @@ export function addServices(
// Ui Service
server.addService(proto.cline.UiService.service, {
scrollToSettings: wrapper(scrollToSettings, controller),
onDidShowAnnouncement: wrapper(onDidShowAnnouncement, controller),
})
// Web Service
+51 -62
View File
@@ -11,6 +11,7 @@
"@floating-ui/react": "^0.27.4",
"@heroui/react": "^2.8.0-beta.2",
"@vscode/webview-ui-toolkit": "^1.4.0",
"clsx": "^2.1.1",
"debounce": "^2.1.1",
"dompurify": "^3.2.4",
"fast-deep-equal": "^3.1.3",
@@ -19,6 +20,7 @@
"fuse.js": "^7.0.0",
"fzf": "^0.5.2",
"katex": "^0.16.22",
"lucide-react": "^0.511.0",
"mermaid": "^11.4.1",
"package.json": "^2.0.1",
"posthog-js": "^1.224.0",
@@ -37,6 +39,7 @@
"remark-math": "^6.0.0",
"remark-stringify": "^11.0.0",
"styled-components": "^6.1.15",
"tailwind-merge": "^3.3.0",
"unified": "^11.0.5",
"uuid": "^9.0.1"
},
@@ -2513,6 +2516,14 @@
"react": ">=18 || >=19.0.0-rc.0"
}
},
"node_modules/@heroui/system-rsc/node_modules/clsx": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
"integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
"engines": {
"node": ">=6"
}
},
"node_modules/@heroui/table": {
"version": "2.2.17-beta.2",
"resolved": "https://registry.npmjs.org/@heroui/table/-/table-2.2.17-beta.2.tgz",
@@ -2590,6 +2601,23 @@
"tailwindcss": ">=4.0.0"
}
},
"node_modules/@heroui/theme/node_modules/clsx": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
"integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
"engines": {
"node": ">=6"
}
},
"node_modules/@heroui/theme/node_modules/tailwind-merge": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.0.2.tgz",
"integrity": "sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/dcastil"
}
},
"node_modules/@heroui/toast": {
"version": "2.0.8-beta.2",
"resolved": "https://registry.npmjs.org/@heroui/toast/-/toast-2.0.8-beta.2.tgz",
@@ -3615,15 +3643,6 @@
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
}
},
"node_modules/@react-aria/focus/node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/@react-aria/form": {
"version": "3.0.14",
"resolved": "https://registry.npmjs.org/@react-aria/form/-/form-3.0.14.tgz",
@@ -3839,15 +3858,6 @@
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
}
},
"node_modules/@react-aria/grid/node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/@react-aria/i18n": {
"version": "3.12.7",
"resolved": "https://registry.npmjs.org/@react-aria/i18n/-/i18n-3.12.7.tgz",
@@ -3970,15 +3980,6 @@
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
}
},
"node_modules/@react-aria/landmark/node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/@react-aria/link": {
"version": "3.7.10",
"resolved": "https://registry.npmjs.org/@react-aria/link/-/link-3.7.10.tgz",
@@ -4290,15 +4291,6 @@
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
}
},
"node_modules/@react-aria/spinbutton/node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/@react-aria/ssr": {
"version": "3.9.7",
"resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.7.tgz",
@@ -4535,15 +4527,6 @@
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
}
},
"node_modules/@react-aria/toggle/node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/@react-aria/toolbar": {
"version": "3.0.0-beta.14",
"resolved": "https://registry.npmjs.org/@react-aria/toolbar/-/toolbar-3.0.0-beta.14.tgz",
@@ -4597,15 +4580,6 @@
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
}
},
"node_modules/@react-aria/utils/node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/@react-aria/visually-hidden": {
"version": "3.8.21",
"resolved": "https://registry.npmjs.org/@react-aria/visually-hidden/-/visually-hidden-3.8.21.tgz",
@@ -8278,10 +8252,9 @@
}
},
"node_modules/clsx": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
"integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
"license": "MIT",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"engines": {
"node": ">=6"
}
@@ -12487,6 +12460,14 @@
"dev": true,
"license": "ISC"
},
"node_modules/lucide-react": {
"version": "0.511.0",
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.511.0.tgz",
"integrity": "sha512-VK5a2ydJ7xm8GvBeKLS9mu1pVK6ucef9780JVUjw6bAjJL/QXnd4Y0p7SPeOUMC27YhzNCZvm5d/QX0Tp3rc0w==",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/lz-string": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
@@ -15865,10 +15846,9 @@
"license": "MIT"
},
"node_modules/tailwind-merge": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.0.2.tgz",
"integrity": "sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==",
"license": "MIT",
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.3.0.tgz",
"integrity": "sha512-fyW/pEfcQSiigd5SNn0nApUOxx0zB/dm6UDU/rEwc2c3sX2smWUNbapHv+QRqLGVp9GWX3THIa7MUGPo+YkDzQ==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/dcastil"
@@ -15890,6 +15870,15 @@
"tailwindcss": "*"
}
},
"node_modules/tailwind-variants/node_modules/tailwind-merge": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.0.2.tgz",
"integrity": "sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/dcastil"
}
},
"node_modules/tailwindcss": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.5.tgz",
+3
View File
@@ -18,6 +18,7 @@
"@floating-ui/react": "^0.27.4",
"@heroui/react": "^2.8.0-beta.2",
"@vscode/webview-ui-toolkit": "^1.4.0",
"clsx": "^2.1.1",
"debounce": "^2.1.1",
"dompurify": "^3.2.4",
"fast-deep-equal": "^3.1.3",
@@ -26,6 +27,7 @@
"fuse.js": "^7.0.0",
"fzf": "^0.5.2",
"katex": "^0.16.22",
"lucide-react": "^0.511.0",
"mermaid": "^11.4.1",
"package.json": "^2.0.1",
"posthog-js": "^1.224.0",
@@ -44,6 +46,7 @@
"remark-math": "^6.0.0",
"remark-stringify": "^11.0.0",
"styled-components": "^6.1.15",
"tailwind-merge": "^3.3.0",
"unified": "^11.0.5",
"uuid": "^9.0.1"
},
+12 -2
View File
@@ -5,9 +5,10 @@ import SettingsView from "./components/settings/SettingsView"
import WelcomeView from "./components/welcome/WelcomeView"
import AccountView from "./components/account/AccountView"
import { useExtensionState } from "./context/ExtensionStateContext"
import { vscode } from "./utils/vscode"
import { UiServiceClient } from "./services/grpc-client"
import McpView from "./components/mcp/configuration/McpConfigurationView"
import { Providers } from "./Providers"
import { Boolean, EmptyRequest } from "@shared/proto/common"
const AppContent = () => {
const {
@@ -21,6 +22,7 @@ const AppContent = () => {
showAccount,
showAnnouncement,
setShowAnnouncement,
setShouldShowAnnouncement,
closeMcpView,
navigateToHistory,
hideSettings,
@@ -32,7 +34,15 @@ const AppContent = () => {
useEffect(() => {
if (shouldShowAnnouncement) {
setShowAnnouncement(true)
vscode.postMessage({ type: "didShowAnnouncement" })
// Use the gRPC client instead of direct WebviewMessage
UiServiceClient.onDidShowAnnouncement({} as EmptyRequest)
.then((response: Boolean) => {
setShouldShowAnnouncement(response.value)
})
.catch((error) => {
console.error("Failed to acknowledge announcement:", error)
})
}
}, [shouldShowAnnouncement])
@@ -71,7 +71,7 @@ export const BrowserSettingsMenu = () => {
// After a short delay, send a message to scroll to browser settings
setTimeout(async () => {
try {
await UiServiceClient.scrollToSettings({ value: "browser-settings-section" })
await UiServiceClient.scrollToSettings({ value: "browser" })
} catch (error) {
console.error("Error scrolling to browser settings:", error)
}
+25 -11
View File
@@ -44,21 +44,15 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
</h3>
<ul style={ulStyle}>
<li>
<b>Workflows:</b> Create and manage workflow files that can be injected into conversations via slash commands,
making it easy to automate repetitive tasks.
<b>Claude 4 Models:</b> Now with support for Anthropic Claude Sonnet 4 and Claude Opus 4 in both Anthropic and
Vertex providers.
</li>
<li>
<b>Collapsible Task List:</b> Hide your recent tasks when sharing your screen to keep your prompts private.
<b>New Settings Page:</b> Redesigned settings, now split into tabs for easier navigation and a cleaner
experience.
</li>
<li>
<b>Global Endpoint for Vertex AI:</b> Improved availability and reduced rate limiting errors for Vertex AI
users.
</li>
<li>
<b>New User Experience:</b> Special components and guidance for new users to help them get started with Cline.
</li>
<li>
<b>UI Improvements:</b> Fixed loading states and improved settings organization for a smoother experience.
<b>Nebius AI Studio:</b> Added Nebius AI Studio as a new provider. (Thanks @Aktsvigun!)
</li>
</ul>
<Accordion isCompact className="pl-0">
@@ -73,6 +67,26 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
"text-[var(--vscode-foreground)] mb-0.5 -rotate-180 data-[open=true]:-rotate-90 rtl:rotate-0 rtl:data-[open=true]:-rotate-90",
}}>
<ul style={ulStyle}>
<li>
<b>Workflows:</b> Create and manage workflow files that can be injected into conversations via slash
commands, making it easy to automate repetitive tasks.
</li>
<li>
<b>Collapsible Task List:</b> Hide your recent tasks when sharing your screen to keep your prompts
private.
</li>
<li>
<b>Global Endpoint for Vertex AI:</b> Improved availability and reduced rate limiting errors for
Vertex AI users.
</li>
<li>
<b>New User Experience:</b> Special components and guidance for new users to help them get started
with Cline.
</li>
<li>
<b>UI Improvements:</b> Fixed loading states and improved settings organization for a smoother
experience.
</li>
<li>
<b>Task Timeline:</b> See the history of your coding journey with a visual timeline of checkpoints.
</li>
@@ -39,6 +39,7 @@ import SlashCommandMenu from "@/components/chat/SlashCommandMenu"
import { ChatSettings } from "@shared/ChatSettings"
import ServersToggleModal from "./ServersToggleModal"
import ClineRulesToggleModal from "../cline-rules/ClineRulesToggleModal"
import { PlanActMode } from "@shared/proto/state"
const getImageDimensions = (dataUrl: string): Promise<{ width: number; height: number }> => {
return new Promise((resolve, reject) => {
@@ -259,7 +260,15 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
},
ref,
) => {
const { filePaths, chatSettings, apiConfiguration, openRouterModels, platform, workflowToggles } = useExtensionState()
const {
filePaths,
chatSettings,
apiConfiguration,
openRouterModels,
platform,
localWorkflowToggles,
globalWorkflowToggles,
} = useExtensionState()
const [isTextAreaFocused, setIsTextAreaFocused] = useState(false)
const [isDraggingOver, setIsDraggingOver] = useState(false)
const [gitCommits, setGitCommits] = useState<GitCommit[]>([])
@@ -483,7 +492,11 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
setSelectedSlashCommandsIndex((prevIndex) => {
const direction = event.key === "ArrowUp" ? -1 : 1
// Get commands with workflow toggles
const allCommands = getMatchingSlashCommands(slashCommandsQuery, workflowToggles)
const allCommands = getMatchingSlashCommands(
slashCommandsQuery,
localWorkflowToggles,
globalWorkflowToggles,
)
if (allCommands.length === 0) {
return prevIndex
@@ -501,7 +514,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
if ((event.key === "Enter" || event.key === "Tab") && selectedSlashCommandsIndex !== -1) {
event.preventDefault()
const commands = getMatchingSlashCommands(slashCommandsQuery, workflowToggles)
const commands = getMatchingSlashCommands(slashCommandsQuery, localWorkflowToggles, globalWorkflowToggles)
if (commands.length > 0) {
handleSlashCommandsSelect(commands[selectedSlashCommandsIndex])
}
@@ -904,7 +917,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
// extract and validate the exact command text
const commandText = processedText.substring(slashIndex + 1, endIndex)
const isValidCommand = validateSlashCommand(commandText, workflowToggles)
const isValidCommand = validateSlashCommand(commandText, localWorkflowToggles, globalWorkflowToggles)
if (isValidCommand) {
const fullCommand = processedText.substring(slashIndex, endIndex) // includes slash
@@ -917,7 +930,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
highlightLayerRef.current.innerHTML = processedText
highlightLayerRef.current.scrollTop = textAreaRef.current.scrollTop
highlightLayerRef.current.scrollLeft = textAreaRef.current.scrollLeft
}, [workflowToggles])
}, [localWorkflowToggles, globalWorkflowToggles])
useLayoutEffect(() => {
updateHighlights()
@@ -965,9 +978,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
changeModeDelay = 250 // necessary to let the api config update (we send message and wait for it to be saved) FIXME: this is a hack and we ideally should check for api config changes, then wait for it to be saved, before switching modes
}
setTimeout(() => {
const newMode = chatSettings.mode === "plan" ? "act" : "plan"
vscode.postMessage({
type: "togglePlanActMode",
const newMode = chatSettings.mode === "plan" ? PlanActMode.ACT : PlanActMode.PLAN
StateServiceClient.togglePlanActMode({
chatSettings: {
mode: newMode,
preferredLanguage: chatSettings.preferredLanguage,
@@ -1071,6 +1083,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
case "litellm":
return `${selectedProvider}:${apiConfiguration.liteLlmModelId}`
case "requesty":
return `${selectedProvider}:${apiConfiguration.requestyModelId}`
case "anthropic":
case "openrouter":
default:
@@ -1399,7 +1412,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
setSelectedIndex={setSelectedSlashCommandsIndex}
onMouseDown={handleMenuMouseDown}
query={slashCommandsQuery}
workflowToggles={workflowToggles}
localWorkflowToggles={localWorkflowToggles}
globalWorkflowToggles={globalWorkflowToggles}
/>
</div>
)}
@@ -7,7 +7,8 @@ interface SlashCommandMenuProps {
setSelectedIndex: (index: number) => void
onMouseDown: () => void
query: string
workflowToggles?: Record<string, boolean>
localWorkflowToggles?: Record<string, boolean>
globalWorkflowToggles?: Record<string, boolean>
}
const SlashCommandMenu: React.FC<SlashCommandMenuProps> = ({
@@ -16,7 +17,8 @@ const SlashCommandMenu: React.FC<SlashCommandMenuProps> = ({
setSelectedIndex,
onMouseDown,
query,
workflowToggles = {},
localWorkflowToggles = {},
globalWorkflowToggles = {},
}) => {
const menuRef = useRef<HTMLDivElement>(null)
@@ -44,7 +46,7 @@ const SlashCommandMenu: React.FC<SlashCommandMenuProps> = ({
}, [selectedIndex])
// Filter commands based on query
const filteredCommands = getMatchingSlashCommands(query, workflowToggles)
const filteredCommands = getMatchingSlashCommands(query, localWorkflowToggles, globalWorkflowToggles)
const defaultCommands = filteredCommands.filter((cmd) => cmd.section === "default" || !cmd.section)
const workflowCommands = filteredCommands.filter((cmd) => cmd.section === "custom")
@@ -8,8 +8,8 @@ interface AutoApproveMenuItemProps {
action: ActionMetadata
isChecked: (action: ActionMetadata) => boolean
isFavorited?: (action: ActionMetadata) => boolean
onToggle: (action: ActionMetadata, checked: boolean) => void
onToggleFavorite?: (actionId: string) => void
onToggle: (action: ActionMetadata, checked: boolean) => Promise<void>
onToggleFavorite?: (actionId: string) => Promise<void>
condensed?: boolean
showIcon?: boolean
}
@@ -83,9 +83,9 @@ const AutoApproveMenuItem = ({
const checked = isChecked(action)
const favorited = isFavorited?.(action)
const onChange = (e: Event) => {
const onChange = async (e: Event) => {
e.stopPropagation()
onToggle(action, !checked)
await onToggle(action, !checked)
}
const content = (
@@ -107,9 +107,10 @@ const AutoApproveMenuItem = ({
style={{
cursor: "pointer",
}}
onClick={(e) => {
onClick={async (e) => {
e.stopPropagation()
onToggleFavorite?.(action.id)
if (action.id === "enableAll") return
await onToggleFavorite?.(action.id)
}}
/>
</HeroTooltip>
@@ -170,13 +170,13 @@ const AutoApproveModal: React.FC<AutoApproveModalProps> = ({
<VSCodeTextField
className="flex-1 w-full pr-[35px] ml-4"
value={autoApprovalSettings.maxRequests.toString()}
onInput={(e) => {
onInput={async (e) => {
const input = e.target as HTMLInputElement
// Remove any non-numeric characters
input.value = input.value.replace(/[^0-9]/g, "")
const value = parseInt(input.value)
if (!isNaN(value) && value > 0) {
updateMaxRequests(value)
await updateMaxRequests(value)
}
}}
onKeyDown={(e) => {
@@ -0,0 +1,18 @@
import { StateServiceClient } from "@/services/grpc-client"
import { AutoApprovalSettings } from "@shared/AutoApprovalSettings"
import { convertAutoApprovalSettingsToProto } from "@shared/proto-conversions/models/auto-approval-settings-conversion"
/**
* Updates auto approval settings using the gRPC/Protobus client
* @param settings The auto approval settings to update
* @throws Error if the update fails
*/
export async function updateAutoApproveSettings(settings: AutoApprovalSettings) {
try {
const protoSettings = convertAutoApprovalSettingsToProto(settings)
await StateServiceClient.updateAutoApprovalSettings(protoSettings)
} catch (error) {
console.error("Failed to update auto approval settings:", error)
throw error
}
}
@@ -4,11 +4,12 @@ import { useExtensionState } from "@/context/ExtensionStateContext"
import { CODE_BLOCK_BG_COLOR } from "@/components/common/CodeBlock"
import { vscode } from "@/utils/vscode"
import { FileServiceClient } from "@/services/grpc-client"
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import RulesToggleList from "./RulesToggleList"
import Tooltip from "@/components/common/Tooltip"
import styled from "styled-components"
import { ClineRulesToggles, ToggleWindsurfRuleRequest } from "@shared/proto/file"
import { ClineRulesToggles, RefreshedRules, ToggleWindsurfRuleRequest } from "@shared/proto/file"
import { EmptyRequest } from "@shared/proto/common"
const ClineRulesToggleModal: React.FC = () => {
const {
@@ -16,11 +17,14 @@ const ClineRulesToggleModal: React.FC = () => {
localClineRulesToggles = {},
localCursorRulesToggles = {},
localWindsurfRulesToggles = {},
workflowToggles = {},
localWorkflowToggles = {},
globalWorkflowToggles = {},
setGlobalClineRulesToggles,
setLocalClineRulesToggles,
setLocalCursorRulesToggles,
setLocalWindsurfRulesToggles,
setLocalWorkflowToggles,
setGlobalWorkflowToggles,
} = useExtensionState()
const [isVisible, setIsVisible] = useState(false)
const buttonRef = useRef<HTMLDivElement>(null)
@@ -32,7 +36,31 @@ const ClineRulesToggleModal: React.FC = () => {
useEffect(() => {
if (isVisible) {
vscode.postMessage({ type: "refreshClineRules" })
FileServiceClient.refreshRules({} as EmptyRequest)
.then((response: RefreshedRules) => {
// Update state with the response data using all available setters
if (response.globalClineRulesToggles?.toggles) {
setGlobalClineRulesToggles(response.globalClineRulesToggles.toggles)
}
if (response.localClineRulesToggles?.toggles) {
setLocalClineRulesToggles(response.localClineRulesToggles.toggles)
}
if (response.localCursorRulesToggles?.toggles) {
setLocalCursorRulesToggles(response.localCursorRulesToggles.toggles)
}
if (response.localWindsurfRulesToggles?.toggles) {
setLocalWindsurfRulesToggles(response.localWindsurfRulesToggles.toggles)
}
if (response.localWorkflowToggles?.toggles) {
setLocalWorkflowToggles(response.localWorkflowToggles.toggles)
}
if (response.globalWorkflowToggles?.toggles) {
setGlobalWorkflowToggles(response.globalWorkflowToggles.toggles)
}
})
.catch((error) => {
console.error("Failed to refresh rules:", error)
})
}
}, [isVisible])
@@ -54,7 +82,11 @@ const ClineRulesToggleModal: React.FC = () => {
.map(([path, enabled]): [string, boolean] => [path, enabled as boolean])
.sort(([a], [b]) => a.localeCompare(b))
const workflows = Object.entries(workflowToggles || {})
const localWorkflows = Object.entries(localWorkflowToggles || {})
.map(([path, enabled]): [string, boolean] => [path, enabled as boolean])
.sort(([a], [b]) => a.localeCompare(b))
const globalWorkflows = Object.entries(globalWorkflowToggles || {})
.map(([path, enabled]): [string, boolean] => [path, enabled as boolean])
.sort(([a], [b]) => a.localeCompare(b))
@@ -110,11 +142,12 @@ const ClineRulesToggleModal: React.FC = () => {
})
}
const toggleWorkflow = (workflowPath: string, enabled: boolean) => {
const toggleWorkflow = (isGlobal: boolean, workflowPath: string, enabled: boolean) => {
vscode.postMessage({
type: "toggleWorkflow",
workflowPath,
enabled,
isGlobal,
})
}
@@ -199,7 +232,13 @@ const ClineRulesToggleModal: React.FC = () => {
{currentView === "rules" ? (
<p>
Rules allow you to provide Cline with system-level guidance. Think of them as a persistent way to
include context and preferences for your projects or globally for every conversation.
include context and preferences for your projects or globally for every conversation.{" "}
<VSCodeLink
href="https://docs.cline.bot/features/cline-rules"
style={{ display: "inline" }}
className="text-xs">
Docs
</VSCodeLink>
</p>
) : (
<p>
@@ -210,7 +249,13 @@ const ClineRulesToggleModal: React.FC = () => {
text-[var(--vscode-foreground)] font-bold">
/workflow-name
</span>{" "}
in the chat.
in the chat.{" "}
<VSCodeLink
href="https://docs.cline.bot/features/slash-commands/workflows"
style={{ display: "inline" }}
className="text-xs">
Docs
</VSCodeLink>
</p>
)}
</div>
@@ -264,19 +309,35 @@ const ClineRulesToggleModal: React.FC = () => {
</div>
</>
) : (
/* Workflows section */
<div style={{ marginBottom: -10 }}>
<div className="text-sm font-normal mb-2">Workspace Workflows</div>
<RulesToggleList
rules={workflows}
toggleRule={toggleWorkflow}
listGap="small"
isGlobal={false}
ruleType={"workflow"}
showNewRule={true}
showNoRules={false}
/>
</div>
<>
{/* Global Workflows Section */}
<div className="mb-3">
<div className="text-sm font-normal mb-2">Global Workflows</div>
<RulesToggleList
rules={globalWorkflows}
toggleRule={(rulePath, enabled) => toggleWorkflow(true, rulePath, enabled)}
listGap="small"
isGlobal={true}
ruleType={"workflow"}
showNewRule={true}
showNoRules={false}
/>
</div>
{/* Local Workflows Section */}
<div style={{ marginBottom: -10 }}>
<div className="text-sm font-normal mb-2">Workspace Workflows</div>
<RulesToggleList
rules={localWorkflows}
toggleRule={(rulePath, enabled) => toggleWorkflow(false, rulePath, enabled)}
listGap="small"
isGlobal={false}
ruleType={"workflow"}
showNewRule={true}
showNoRules={false}
/>
</div>
</>
)}
</div>
)}
@@ -9,8 +9,10 @@ const RuleRow: React.FC<{
ruleType: string
toggleRule: (rulePath: string, enabled: boolean) => void
}> = ({ rulePath, enabled, isGlobal, toggleRule, ruleType }) => {
// Check if the path type is Windows
const win32Path = /^[a-zA-Z]:\\/.test(rulePath)
// Get the filename from the path for display
const displayName = rulePath.split("/").pop() || rulePath
const displayName = rulePath.split(win32Path ? "\\" : "/").pop() || rulePath
const getRuleTypeIcon = () => {
switch (ruleType) {
@@ -0,0 +1,111 @@
import React, { ReactNode } from "react"
import { cn } from "@/utils/cn"
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
import { AlertTriangle } from "lucide-react"
import { OPENROUTER_MODEL_PICKER_Z_INDEX } from "../settings/OpenRouterModelPicker"
interface AlertDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
children: ReactNode
}
export function AlertDialog({ open, onOpenChange, children }: AlertDialogProps) {
if (!open) return null
// Close the dialog when clicking on the backdrop
const handleBackdropClick = (e: React.MouseEvent) => {
if (e.target === e.currentTarget) {
onOpenChange(false)
}
}
return (
<div
className={cn(`fixed inset-0 bg-black/50 flex items-center justify-center`)}
onClick={handleBackdropClick}
style={{ zIndex: OPENROUTER_MODEL_PICKER_Z_INDEX + 50 }}>
{children}
</div>
)
}
export function AlertDialogContent({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn(
`fixed top-[50%] left-[50%] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%]`,
className,
)}
onClick={(e) => e.stopPropagation()}
{...props}>
<div className="bg-[var(--vscode-editor-background)] rounded-sm gap-3 border border-[var(--vscode-panel-border)] p-4 shadow-lg sm:max-w-md">
{children}
</div>
</div>
)
}
export function AlertDialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div className={cn("flex flex-col gap-1 text-left", className)} {...props} />
}
export function AlertDialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div className={cn("flex flex-row justify-end gap-2 mt-4", className)} {...props} />
}
export function AlertDialogTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
return (
<h2
className={cn(
"text-base font-medium text-[var(--vscode-editor-foreground)] flex items-center gap-2 text-left",
className,
)}
{...props}
/>
)
}
export function AlertDialogDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {
return <p className={cn("text-[var(--vscode-descriptionForeground)] text-sm text-left", className)} {...props} />
}
export function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof VSCodeButton>) {
return <VSCodeButton appearance="primary" {...props} />
}
export function AlertDialogCancel({ className, ...props }: React.ComponentProps<typeof VSCodeButton>) {
return <VSCodeButton appearance="secondary" {...props} />
}
export function UnsavedChangesDialog({
open,
onOpenChange,
onConfirm,
onCancel,
}: {
open: boolean
onOpenChange: (open: boolean) => void
onConfirm: () => void
onCancel: () => void
}) {
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
<AlertTriangle className="w-5 h-5 text-[var(--vscode-errorForeground)]" />
Unsaved Changes
</AlertDialogTitle>
<AlertDialogDescription>
You have unsaved changes. Are you sure you want to discard them?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel onClick={onCancel}>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={onConfirm}>Discard Changes</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}
@@ -10,6 +10,27 @@ import type { Node } from "unist"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { CODE_BLOCK_BG_COLOR } from "@/components/common/CodeBlock"
import MermaidBlock from "@/components/common/MermaidBlock"
import { StateServiceClient } from "@/services/grpc-client"
import { PlanActMode } from "@shared/proto/state"
// Styled component for Act Mode text with more specific styling
const ActModeHighlight: React.FC = () => (
<span
onClick={() => {
StateServiceClient.togglePlanActMode({
chatSettings: {
mode: PlanActMode.ACT,
},
})
}}
title="Click to toggle to Act Mode"
className="text-[var(--vscode-textLink-foreground)] hover:opacity-90 cursor-pointer inline-flex items-center gap-1">
<div className="p-1 rounded-[12px] bg-[var(--vscode-editor-background)] flex items-center justify-end w-4 border-[1px] border-[var(--vscode-input-border)]">
<div className="rounded-full bg-[var(--vscode-textLink-foreground)] w-2 h-2" />
</div>
Act Mode (A)
</span>
)
interface MarkdownBlockProps {
markdown?: string
@@ -55,6 +76,68 @@ const remarkUrlToLink = () => {
}
}
/**
* Custom remark plugin that highlights "to Act Mode" mentions and adds keyboard shortcut hint
*/
const remarkHighlightActMode = () => {
return (tree: Node) => {
visit(tree, "text", (node: any, index, parent) => {
// Case-insensitive regex to match "to Act Mode" in various capitalizations
// Using word boundaries to avoid matching within words
// Added negative lookahead to avoid matching if already followed by the shortcut
const actModeRegex = /\bto\s+Act\s+Mode\b(?!\s*\(⌘⇧A\))/i
if (!node.value.match(actModeRegex)) return
// Split the text by the matches
const parts = node.value.split(actModeRegex)
const matches = node.value.match(actModeRegex)
if (!matches || parts.length <= 1) return
const children: any[] = []
parts.forEach((part: string, i: number) => {
// Add the text before the match
if (part) children.push({ type: "text", value: part })
// Add the match, but only make "Act Mode" bold (not the "to" part)
if (matches[i]) {
// Extract "to" and "Act Mode" parts
const matchText = matches[i]
const toIndex = matchText.toLowerCase().indexOf("to")
const actModeIndex = matchText.toLowerCase().indexOf("act mode", toIndex + 2)
if (toIndex !== -1 && actModeIndex !== -1) {
// Add "to" as regular text
const toPart = matchText.substring(toIndex, actModeIndex).trim()
children.push({ type: "text", value: toPart + " " })
// Add "Act Mode" as bold with keyboard shortcut
const actModePart = matchText.substring(actModeIndex)
children.push({
type: "strong",
children: [{ type: "text", value: `${actModePart} (⌘⇧A)` }],
})
} else {
// Fallback if we can't parse it correctly
children.push({ type: "text", value: matchText + " " })
children.push({
type: "strong",
children: [{ type: "text", value: `(⌘⇧A)` }],
})
}
}
})
// Replace the original text node with our new nodes
if (parent) {
parent.children.splice(index, 1, ...children)
}
})
}
}
/**
* Custom remark plugin that prevents filenames with extensions from being parsed as bold text
* For example: __init__.py should not be rendered as bold "init" followed by ".py"
@@ -286,6 +369,7 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {
remarkPlugins: [
remarkPreventBoldFilenames,
remarkUrlToLink,
remarkHighlightActMode,
remarkMath,
() => {
return (tree) => {
@@ -329,6 +413,27 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {
}
return <code {...props} />
},
strong: (props: ComponentProps<"strong">) => {
// Check if this is an "Act Mode" strong element by looking for the keyboard shortcut
// Handle both string children and array of children cases
const childrenText = React.Children.toArray(props.children)
.map((child) => {
if (typeof child === "string") return child
if (typeof child === "object" && "props" in child && child.props.children)
return String(child.props.children)
return ""
})
.join("")
// Case-insensitive check for "Act Mode (⌘⇧A)" pattern
// This ensures we only style the exact "Act Mode" mentions with keyboard shortcut
// Using case-insensitive flag to catch all capitalization variations
if (/^act mode\s*\(⌘⇧A\)$/i.test(childrenText)) {
return <ActModeHighlight />
}
return <strong {...props} />
},
},
},
})
+93
View File
@@ -0,0 +1,93 @@
import React, { HTMLAttributes, useCallback, forwardRef } from "react"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { cn } from "@/utils/cn"
type TabProps = HTMLAttributes<HTMLDivElement>
export const Tab = ({ className, children, ...props }: TabProps) => (
<div className={cn("fixed inset-0 flex flex-col", className)} {...props}>
{children}
</div>
)
export const TabHeader = ({ className, children, ...props }: TabProps) => (
<div className={cn("px-5 py-2.5 border-b border-[var(--vscode-panel-border)]", className)} {...props}>
{children}
</div>
)
export const TabContent = ({ className, children, ...props }: TabProps) => {
const onWheel = useCallback((e: React.WheelEvent<HTMLDivElement>) => {
const target = e.target as HTMLElement
// Prevent scrolling if the target is a listbox or option
// (e.g. selects, dropdowns, etc).
if (target.role === "listbox" || target.role === "option") {
return
}
e.currentTarget.scrollTop += e.deltaY
}, [])
return (
<div className={cn("flex-1 overflow-auto", className)} onWheel={onWheel} {...props}>
{children}
</div>
)
}
export const TabList = forwardRef<
HTMLDivElement,
HTMLAttributes<HTMLDivElement> & {
value: string
onValueChange: (value: string) => void
}
>(({ children, className, value, onValueChange, ...props }, ref) => {
const handleTabSelect = useCallback(
(tabValue: string) => {
console.log("Tab selected:", tabValue)
onValueChange(tabValue)
},
[onValueChange],
)
return (
<div ref={ref} role="tablist" className={cn("flex", className)} {...props}>
{React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
// Make sure we're passing the correct props to the TabTrigger
return React.cloneElement(child as React.ReactElement<any>, {
isSelected: child.props.value === value,
onSelect: () => handleTabSelect(child.props.value),
})
}
return child
})}
</div>
)
})
export const TabTrigger = forwardRef<
HTMLButtonElement,
React.ButtonHTMLAttributes<HTMLButtonElement> & {
value: string
isSelected?: boolean
onSelect?: () => void
}
>(({ children, className, value, isSelected, onSelect, ...props }, ref) => {
// Ensure we're using the value prop correctly
return (
<button
ref={ref}
role="tab"
aria-selected={isSelected}
tabIndex={isSelected ? 0 : -1}
className={cn("focus:outline-none", className)}
onClick={onSelect}
data-value={value} // Add data-value attribute for debugging
{...props}>
{children}
</button>
)
})
@@ -1,9 +1,12 @@
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import { vscode } from "@/utils/vscode"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { UiServiceClient } from "@/services/grpc-client"
import ServersToggleList from "./ServersToggleList"
const InstalledServersView = () => {
const { mcpServers: servers } = useExtensionState()
const { mcpServers: servers, navigateToSettings } = useExtensionState()
return (
<div style={{ padding: "16px 20px" }}>
@@ -46,10 +49,17 @@ const InstalledServersView = () => {
<div style={{ textAlign: "center" }}>
<VSCodeLink
onClick={() => {
vscode.postMessage({
type: "openExtensionSettings",
text: "cline.mcp",
})
// First open the settings panel using direct navigation
navigateToSettings()
// After a short delay, send a message to scroll to browser settings
setTimeout(async () => {
try {
await UiServiceClient.scrollToSettings({ value: "features" })
} catch (error) {
console.error("Error scrolling to mcp settings:", error)
}
}, 300)
}}
style={{ fontSize: "12px" }}>
Advanced MCP Settings
@@ -47,13 +47,14 @@ import {
askSageDefaultURL,
xaiDefaultModelId,
xaiModels,
nebiusModels,
nebiusDefaultModelId,
sambanovaModels,
sambanovaDefaultModelId,
doubaoModels,
doubaoDefaultModelId,
liteLlmModelInfoSaneDefaults,
} from "@shared/api"
import { ExtensionMessage } from "@shared/ExtensionMessage"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { vscode } from "@/utils/vscode"
import { ModelsServiceClient } from "@/services/grpc-client"
@@ -324,6 +325,7 @@ const ApiOptions = ({
<VSCodeOption value="lmstudio">LM Studio</VSCodeOption>
<VSCodeOption value="ollama">Ollama</VSCodeOption>
<VSCodeOption value="litellm">LiteLLM</VSCodeOption>
<VSCodeOption value="nebius">Nebius AI Studio</VSCodeOption>
<VSCodeOption value="asksage">AskSage</VSCodeOption>
<VSCodeOption value="xai">xAI</VSCodeOption>
<VSCodeOption value="sambanova">SambaNova</VSCodeOption>
@@ -891,8 +893,14 @@ const ApiOptions = ({
</div>
)}
{(selectedModelId === "anthropic.claude-3-7-sonnet-20250219-v1:0" ||
selectedModelId === "anthropic.claude-sonnet-4-20250514-v1:0" ||
selectedModelId === "anthropic.claude-opus-4-20250514-v1:0" ||
(apiConfiguration?.awsBedrockCustomSelected &&
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-3-7-sonnet-20250219-v1:0")) && (
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-3-7-sonnet-20250219-v1:0") ||
(apiConfiguration?.awsBedrockCustomSelected &&
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-sonnet-4-20250514-v1:0") ||
(apiConfiguration?.awsBedrockCustomSelected &&
apiConfiguration?.awsBedrockCustomModelBaseId === "anthropic.claude-opus-4-20250514-v1:0")) && (
<ThinkingBudgetSlider apiConfiguration={apiConfiguration} setApiConfiguration={setApiConfiguration} />
)}
<ModelInfoView
@@ -1645,7 +1653,7 @@ const ApiOptions = ({
value={apiConfiguration?.liteLlmModelId || ""}
style={{ width: "100%" }}
onInput={handleInputChange("liteLlmModelId")}
placeholder={"e.g. anthropic/claude-3-7-sonnet-20250219"}>
placeholder={"e.g. anthropic/claude-sonnet-4-20250514"}>
<span style={{ fontWeight: 500 }}>Model ID</span>
</VSCodeTextField>
@@ -1679,7 +1687,7 @@ const ApiOptions = ({
marginTop: "5px",
color: "var(--vscode-descriptionForeground)",
}}>
Extended thinking is available for models as Sonnet-3-7, o3-mini, Deepseek R1, etc. More info on{" "}
Extended thinking is available for models such as Sonnet-4, o3-mini, Deepseek R1, etc. More info on{" "}
<VSCodeLink
href="https://docs.litellm.ai/docs/reasoning_content"
style={{ display: "inline", fontSize: "inherit" }}>
@@ -1884,6 +1892,52 @@ const ApiOptions = ({
</div>
)}
{selectedProvider === "nebius" && (
<div>
<VSCodeTextField
value={apiConfiguration?.nebiusApiKey || ""}
style={{ width: "100%" }}
type="password"
onInput={handleInputChange("nebiusApiKey")}
placeholder="Enter API Key...">
<span style={{ fontWeight: 500 }}>Nebius API Key</span>
</VSCodeTextField>
<p
style={{
fontSize: "12px",
marginTop: 3,
color: "var(--vscode-descriptionForeground)",
}}>
This key is stored locally and only used to make API requests from this extension.{" "}
{!apiConfiguration?.nebiusApiKey && (
<VSCodeLink
href="https://studio.nebius.com/settings/api-keys"
style={{
display: "inline",
fontSize: "inherit",
}}>
You can get a Nebius API key by signing up here.{" "}
</VSCodeLink>
)}
<span style={{ color: "var(--vscode-errorForeground)" }}>
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude
models. Less capable models may not work as expected.)
</span>
</p>
</div>
)}
{apiErrorMessage && (
<p
style={{
margin: "-10px 0 4px 0",
fontSize: 12,
color: "var(--vscode-errorForeground)",
}}>
{apiErrorMessage}
</p>
)}
{selectedProvider === "xai" && (
<div>
<VSCodeTextField
@@ -1900,6 +1954,10 @@ const ApiOptions = ({
marginTop: 3,
color: "var(--vscode-descriptionForeground)",
}}>
<span style={{ color: "var(--vscode-errorForeground)" }}>
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude
models. Less capable models may not work as expected.)
</span>
This key is stored locally and only used to make API requests from this extension.
{!apiConfiguration?.xaiApiKey && (
<VSCodeLink href="https://x.ai" style={{ display: "inline", fontSize: "inherit" }}>
@@ -2072,12 +2130,22 @@ const ApiOptions = ({
{selectedProvider === "asksage" && createDropdown(askSageModels)}
{selectedProvider === "xai" && createDropdown(xaiModels)}
{selectedProvider === "sambanova" && createDropdown(sambanovaModels)}
{selectedProvider === "nebius" && createDropdown(nebiusModels)}
</DropdownContainer>
{((selectedProvider === "anthropic" && selectedModelId === "claude-3-7-sonnet-20250219") ||
(selectedProvider === "vertex" && selectedModelId === "claude-3-7-sonnet@20250219")) && (
<ThinkingBudgetSlider apiConfiguration={apiConfiguration} setApiConfiguration={setApiConfiguration} />
)}
{(selectedProvider === "anthropic" &&
(selectedModelId === "claude-3-7-sonnet-20250219" ||
selectedModelId === "claude-sonnet-4-20250514" ||
selectedModelId === "claude-opus-4-20250514")) ||
(selectedProvider === "vertex" &&
(selectedModelId === "claude-3-7-sonnet@20250219" ||
selectedModelId === "claude-sonnet-4@20250514" ||
selectedModelId === "claude-opus-4@20250514") && (
<ThinkingBudgetSlider
apiConfiguration={apiConfiguration}
setApiConfiguration={setApiConfiguration}
/>
))}
{selectedProvider === "xai" && selectedModelId.includes("3-mini") && (
<>
@@ -2488,6 +2556,8 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration):
}
case "xai":
return getProviderData(xaiModels, xaiDefaultModelId)
case "nebius":
return getProviderData(nebiusModels, nebiusDefaultModelId)
case "sambanova":
return getProviderData(sambanovaModels, sambanovaDefaultModelId)
default:
@@ -366,11 +366,7 @@ export const BrowserSettingsSection: React.FC = () => {
const isSubSettingsOpen = !(browserSettings.disableToolUse || false)
return (
<div
id="browser-settings-section"
style={{ marginBottom: 20, borderTop: "1px solid var(--vscode-panel-border)", paddingTop: 15 }}>
<h3 style={{ color: "var(--vscode-foreground)", margin: "0 0 10px 0", fontSize: "14px" }}>Browser Settings</h3>
<div id="browser-settings-section" style={{ marginBottom: 20 }}>
{/* Master Toggle */}
<div style={{ marginBottom: isSubSettingsOpen ? 0 : 10 }}>
<VSCodeCheckbox
@@ -14,8 +14,7 @@ const FeatureSettingsSection = () => {
} = useExtensionState()
return (
<div style={{ marginBottom: 20, borderTop: "1px solid var(--vscode-panel-border)", paddingTop: 15 }}>
<h3 style={{ color: "var(--vscode-foreground)", margin: "0 0 10px 0", fontSize: "14px" }}>Feature Settings</h3>
<div style={{ marginBottom: 20 }}>
<div>
<VSCodeCheckbox
checked={enableCheckpointsSetting}
@@ -7,7 +7,6 @@ import styled from "styled-components"
import { openRouterDefaultModelId } from "@shared/api"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { ModelsServiceClient, StateServiceClient } from "@/services/grpc-client"
import { vscode } from "@/utils/vscode"
import { highlight } from "../history/HistoryView"
import { ModelInfoView, normalizeApiConfiguration } from "./ApiOptions"
import { CODE_BLOCK_BG_COLOR } from "@/components/common/CodeBlock"
@@ -42,8 +41,8 @@ export interface OpenRouterModelPickerProps {
// Featured models for Cline provider
const featuredModels = [
{
id: "anthropic/claude-3.7-sonnet",
description: "Leading model for agentic coding",
id: "anthropic/claude-sonnet-4",
description: "Best model for agentic coding",
label: "Best",
},
{
@@ -199,6 +198,8 @@ const OpenRouterModelPicker: React.FC<OpenRouterModelPickerProps> = ({ isPopup }
const showBudgetSlider = useMemo(() => {
return (
selectedModelId?.toLowerCase().includes("claude-sonnet-4") ||
selectedModelId?.toLowerCase().includes("claude-opus-4") ||
selectedModelId?.toLowerCase().includes("claude-3-7-sonnet") ||
selectedModelId?.toLowerCase().includes("claude-3.7-sonnet") ||
selectedModelId?.toLowerCase().includes("claude-3.7-sonnet:thinking")
@@ -335,8 +336,8 @@ const OpenRouterModelPicker: React.FC<OpenRouterModelPickerProps> = ({ isPopup }
If you're unsure which model to choose, Cline works best with{" "}
<VSCodeLink
style={{ display: "inline", fontSize: "inherit" }}
onClick={() => handleModelChange("anthropic/claude-3.7-sonnet")}>
anthropic/claude-3.7-sonnet.
onClick={() => handleModelChange("anthropic/claude-sonnet-4")}>
anthropic/claude-sonnet-4.
</VSCodeLink>
You can also try searching "free" for no-cost options currently available.
</>
@@ -9,7 +9,7 @@ interface PreferredLanguageSettingProps {
const PreferredLanguageSetting: React.FC<PreferredLanguageSettingProps> = ({ chatSettings, setChatSettings }) => {
return (
<div style={{ marginTop: 10, marginBottom: 10 }}>
<div style={{}}>
<label htmlFor="preferred-language-dropdown" className="block mb-1 text-sm font-medium">
Preferred Language
</label>
@@ -0,0 +1,10 @@
import { HTMLAttributes } from "react"
import { cn } from "@/utils/cn"
type SectionProps = HTMLAttributes<HTMLDivElement>
export const Section = ({ className, ...props }: SectionProps) => (
<div className={cn("flex flex-col gap-3 p-5 py-2", className)} {...props} />
)
export default Section
@@ -0,0 +1,26 @@
import { HTMLAttributes } from "react"
import { cn } from "@/utils/cn"
import { OPENROUTER_MODEL_PICKER_Z_INDEX } from "./OpenRouterModelPicker"
type SectionHeaderProps = HTMLAttributes<HTMLDivElement> & {
children: React.ReactNode
description?: string
}
export const SectionHeader = ({ description, children, className, ...props }: SectionHeaderProps) => {
return (
<div
className={cn(
`sticky top-0 text-[var(--vscode-foreground)] bg-[var(--vscode-panel-background)] px-5 py-3`,
className,
)}
{...props}
style={{ zIndex: OPENROUTER_MODEL_PICKER_Z_INDEX + 20 }}>
<h4 className="m-0">{children}</h4>
{description && <p className="text-[var(--vscode-descriptionForeground)] text-sm mt-2 mb-0">{description}</p>}
</div>
)
}
export default SectionHeader
@@ -6,7 +6,25 @@ import {
VSCodeOption,
VSCodeTextArea,
} from "@vscode/webview-ui-toolkit/react"
import { memo, useCallback, useEffect, useState } from "react"
import { memo, useCallback, useEffect, useState, useRef } from "react"
import {
Settings,
Webhook,
CheckCheck,
SquareMousePointer,
GitBranch,
Bell,
Database,
SquareTerminal,
FlaskConical,
Globe,
Info,
LucideIcon,
} from "lucide-react"
import HeroTooltip from "@/components/common/HeroTooltip"
import { UnsavedChangesDialog } from "@/components/common/AlertDialog"
import SectionHeader from "./SectionHeader"
import Section from "./Section"
import PreferredLanguageSetting from "./PreferredLanguageSetting" // Added import
import { OpenAIReasoningEffort } from "@shared/ChatSettings"
import { useExtensionState } from "@/context/ExtensionStateContext"
@@ -22,13 +40,98 @@ import FeatureSettingsSection from "./FeatureSettingsSection"
import BrowserSettingsSection from "./BrowserSettingsSection"
import TerminalSettingsSection from "./TerminalSettingsSection"
import { FEATURE_FLAGS } from "@shared/services/feature-flags/feature-flags"
import { Tab, TabContent, TabHeader, TabList, TabTrigger } from "../common/Tab"
import { cn } from "@/utils/cn"
import { PlanActMode } from "@shared/proto/state"
const { IS_DEV } = process.env
// Styles for the tab system
const settingsTabsContainer = "flex flex-1 overflow-hidden [&.narrow_.tab-label]:hidden"
const settingsTabList =
"w-48 data-[compact=true]:w-12 flex-shrink-0 flex flex-col overflow-y-auto overflow-x-hidden border-r border-[var(--vscode-sideBar-background)]"
const settingsTabTrigger =
"whitespace-nowrap overflow-hidden min-w-0 h-12 px-4 py-3 box-border flex items-center border-l-2 border-transparent text-[var(--vscode-foreground)] opacity-70 bg-transparent hover:bg-[var(--vscode-list-hoverBackground)] data-[compact=true]:w-12 data-[compact=true]:p-4 cursor-pointer"
const settingsTabTriggerActive =
"opacity-100 border-l-2 border-l-[var(--vscode-focusBorder)] border-t-0 border-r-0 border-b-0 bg-[var(--vscode-list-activeSelectionBackground)]"
// Tab definitions
interface SettingsTab {
id: string
name: string
tooltipText: string
headerText: string
icon: LucideIcon
}
export const SETTINGS_TABS: SettingsTab[] = [
{
id: "api-config",
name: "API Configuration",
tooltipText: "API Configuration",
headerText: "API Configuration",
icon: Webhook,
},
{
id: "general",
name: "General",
tooltipText: "General Settings",
headerText: "General Settings",
icon: Settings,
},
{
id: "features",
name: "Features",
tooltipText: "Feature Settings",
headerText: "Feature Settings",
icon: CheckCheck,
},
{
id: "browser",
name: "Browser",
tooltipText: "Browser Settings",
headerText: "Browser Settings",
icon: SquareMousePointer,
},
{
id: "terminal",
name: "Terminal",
tooltipText: "Terminal Settings",
headerText: "Terminal Settings",
icon: SquareTerminal,
},
// Only show in dev mode
...(IS_DEV
? [
{
id: "debug",
name: "Debug",
tooltipText: "Debug Tools",
headerText: "Debug",
icon: FlaskConical,
},
]
: []),
{
id: "about",
name: "About",
tooltipText: "About Cline",
headerText: "About",
icon: Info,
},
]
type SettingsViewProps = {
onDone: () => void
targetSection?: string
}
const SettingsView = ({ onDone }: SettingsViewProps) => {
const SettingsView = ({ onDone, targetSection }: SettingsViewProps) => {
// Track if there are unsaved changes
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false)
// State for the unsaved changes dialog
const [isUnsavedChangesDialogOpen, setIsUnsavedChangesDialogOpen] = useState(false)
// Store the action to perform after confirmation
const pendingAction = useRef<() => void>()
const {
apiConfiguration,
version,
@@ -42,8 +145,22 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
planActSeparateModelsSetting,
setPlanActSeparateModelsSetting,
enableCheckpointsSetting,
setEnableCheckpointsSetting,
mcpMarketplaceEnabled,
setMcpMarketplaceEnabled,
setApiConfiguration,
} = useExtensionState()
// Store the original state to detect changes
const originalState = useRef({
apiConfiguration,
customInstructions,
telemetrySetting,
planActSeparateModelsSetting,
enableCheckpointsSetting,
mcpMarketplaceEnabled,
chatSettings,
})
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
const [modelIdErrorMessage, setModelIdErrorMessage] = useState<string | undefined>(undefined)
const [pendingTabChange, setPendingTabChange] = useState<"plan" | "act" | null>(null)
@@ -96,6 +213,89 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
setModelIdErrorMessage(undefined)
}, [apiConfiguration])
// Check for unsaved changes by comparing current state with original state
useEffect(() => {
const hasChanges =
JSON.stringify(apiConfiguration) !== JSON.stringify(originalState.current.apiConfiguration) ||
customInstructions !== originalState.current.customInstructions ||
telemetrySetting !== originalState.current.telemetrySetting ||
planActSeparateModelsSetting !== originalState.current.planActSeparateModelsSetting ||
enableCheckpointsSetting !== originalState.current.enableCheckpointsSetting ||
mcpMarketplaceEnabled !== originalState.current.mcpMarketplaceEnabled ||
JSON.stringify(chatSettings) !== JSON.stringify(originalState.current.chatSettings)
setHasUnsavedChanges(hasChanges)
}, [
apiConfiguration,
customInstructions,
telemetrySetting,
planActSeparateModelsSetting,
enableCheckpointsSetting,
mcpMarketplaceEnabled,
chatSettings,
])
// Handle cancel button click
const handleCancel = useCallback(() => {
if (hasUnsavedChanges) {
// Show confirmation dialog
setIsUnsavedChangesDialogOpen(true)
pendingAction.current = () => {
// Reset all tracked state to original values
setCustomInstructions(originalState.current.customInstructions)
setTelemetrySetting(originalState.current.telemetrySetting)
setPlanActSeparateModelsSetting(originalState.current.planActSeparateModelsSetting)
setChatSettings(originalState.current.chatSettings)
if (typeof setApiConfiguration === "function") {
setApiConfiguration(originalState.current.apiConfiguration ?? {})
}
if (typeof setEnableCheckpointsSetting === "function") {
setEnableCheckpointsSetting(
typeof originalState.current.enableCheckpointsSetting === "boolean"
? originalState.current.enableCheckpointsSetting
: false,
)
}
if (typeof setMcpMarketplaceEnabled === "function") {
setMcpMarketplaceEnabled(
typeof originalState.current.mcpMarketplaceEnabled === "boolean"
? originalState.current.mcpMarketplaceEnabled
: false,
)
}
// Close settings view
onDone()
}
} else {
// No changes, just close
onDone()
}
}, [
hasUnsavedChanges,
onDone,
setCustomInstructions,
setTelemetrySetting,
setPlanActSeparateModelsSetting,
setChatSettings,
setApiConfiguration,
setEnableCheckpointsSetting,
setMcpMarketplaceEnabled,
])
// Handle confirmation dialog actions
const handleConfirmDiscard = useCallback(() => {
setIsUnsavedChangesDialogOpen(false)
if (pendingAction.current) {
pendingAction.current()
pendingAction.current = undefined
}
}, [])
const handleCancelDiscard = useCallback(() => {
setIsUnsavedChangesDialogOpen(false)
pendingAction.current = undefined
}, [])
// validate as soon as the component is mounted
/*
useEffect will use stale values of variables if they are not included in the dependency array.
@@ -115,10 +315,9 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
switch (message.type) {
case "didUpdateSettings":
if (pendingTabChange) {
vscode.postMessage({
type: "togglePlanActMode",
StateServiceClient.togglePlanActMode({
chatSettings: {
mode: pendingTabChange,
mode: pendingTabChange === "plan" ? PlanActMode.PLAN : PlanActMode.ACT,
preferredLanguage: chatSettings.preferredLanguage,
openAIReasoningEffort: chatSettings.openAIReasoningEffort,
},
@@ -126,24 +325,35 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
setPendingTabChange(null)
}
break
// Handle tab navigation through targetSection prop instead
case "grpc_response":
if (message.grpc_response?.message?.action === "scrollToSettings") {
setTimeout(() => {
const elementId = message.grpc_response?.message?.value
if (elementId) {
const element = document.getElementById(elementId)
if (element) {
element.scrollIntoView({ behavior: "smooth" })
const tabId = message.grpc_response?.message?.value
if (tabId) {
console.log("Opening settings tab from GRPC response:", tabId)
// Check if the value corresponds to a valid tab ID
const isValidTabId = SETTINGS_TABS.some((tab) => tab.id === tabId)
element.style.transition = "background-color 0.5s ease"
element.style.backgroundColor = "var(--vscode-textPreformat-background)"
if (isValidTabId) {
// Set the active tab directly
setActiveTab(tabId)
} else {
// Fall back to the old behavior of scrolling to an element
setTimeout(() => {
const element = document.getElementById(tabId)
if (element) {
element.scrollIntoView({ behavior: "smooth" })
setTimeout(() => {
element.style.backgroundColor = "transparent"
}, 1200)
}
element.style.transition = "background-color 0.5s ease"
element.style.backgroundColor = "var(--vscode-textPreformat-background)"
setTimeout(() => {
element.style.backgroundColor = "transparent"
}, 1200)
}
}, 300)
}
}, 300)
}
}
break
}
@@ -161,7 +371,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
}
}
const handleTabChange = (tab: "plan" | "act") => {
const handlePlanActModeChange = (tab: "plan" | "act") => {
if (tab === chatSettings.mode) {
return
}
@@ -169,136 +379,338 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
handleSubmit(true)
}
// Track active tab
const [activeTab, setActiveTab] = useState<string>(targetSection || SETTINGS_TABS[0].id)
// Update active tab when targetSection changes
useEffect(() => {
if (targetSection) {
setActiveTab(targetSection)
}
}, [targetSection])
// Enhanced tab change handler with debugging
const handleTabChange = useCallback(
(tabId: string) => {
console.log("Tab change requested:", tabId, "Current:", activeTab)
setActiveTab(tabId)
},
[activeTab],
)
// Debug tab changes
useEffect(() => {
console.log("Active tab changed to:", activeTab)
}, [activeTab])
// Track whether we're in compact mode
const [isCompactMode, setIsCompactMode] = useState(false)
const containerRef = useRef<HTMLDivElement>(null)
// Setup resize observer to detect when we should switch to compact mode
useEffect(() => {
if (!containerRef.current) return
const observer = new ResizeObserver((entries) => {
for (const entry of entries) {
// If container width is less than 500px, switch to compact mode
setIsCompactMode(entry.contentRect.width < 500)
}
})
observer.observe(containerRef.current)
return () => {
observer?.disconnect()
}
}, [])
return (
<div className="fixed top-0 left-0 right-0 bottom-0 pt-[10px] pr-0 pb-0 pl-5 flex flex-col overflow-hidden">
<div className="flex justify-between items-center mb-[13px] pr-[17px]">
<h3 className="text-[var(--vscode-foreground)] m-0">Settings</h3>
<VSCodeButton onClick={() => handleSubmit(false)}>Save</VSCodeButton>
<Tab>
<TabHeader className="flex justify-between items-center gap-2">
<div className="flex items-center gap-1">
<h3 className="text-[var(--vscode-foreground)] m-0">Settings</h3>
</div>
<div className="flex gap-2">
<VSCodeButton appearance="secondary" onClick={handleCancel}>
Cancel
</VSCodeButton>
<VSCodeButton onClick={() => handleSubmit(false)} disabled={!hasUnsavedChanges}>
Save
</VSCodeButton>
</div>
</TabHeader>
{/* Vertical tabs layout */}
<div ref={containerRef} className={cn(settingsTabsContainer, isCompactMode && "narrow")}>
{/* Tab sidebar */}
<TabList
value={activeTab}
onValueChange={handleTabChange}
className={cn(settingsTabList)}
data-compact={isCompactMode}>
{SETTINGS_TABS.map((tab) =>
isCompactMode ? (
<HeroTooltip key={tab.id} content={tab.tooltipText} placement="right">
<div
className={cn(
activeTab === tab.id
? `${settingsTabTrigger} ${settingsTabTriggerActive}`
: settingsTabTrigger,
"focus:ring-0",
)}
data-compact={isCompactMode}
data-testid={`tab-${tab.id}`}
data-value={tab.id}
onClick={() => {
console.log("Compact tab clicked:", tab.id)
handleTabChange(tab.id)
}}>
<div className={cn("flex items-center gap-2", isCompactMode && "justify-center")}>
<tab.icon className="w-4 h-4" />
<span className="tab-label">{tab.name}</span>
</div>
</div>
</HeroTooltip>
) : (
<TabTrigger
key={tab.id}
value={tab.id}
className={cn(
activeTab === tab.id
? `${settingsTabTrigger} ${settingsTabTriggerActive}`
: settingsTabTrigger,
"focus:ring-0",
)}
data-compact={isCompactMode}
data-testid={`tab-${tab.id}`}>
<div className={cn("flex items-center gap-2", isCompactMode && "justify-center")}>
<tab.icon className="w-4 h-4" />
<span className="tab-label">{tab.name}</span>
</div>
</TabTrigger>
),
)}
</TabList>
{/* Helper function to render section header */}
{(() => {
const renderSectionHeader = (tabId: string) => {
const tab = SETTINGS_TABS.find((t) => t.id === tabId)
if (!tab) return null
return (
<SectionHeader>
<div className="flex items-center gap-2">
{(() => {
const Icon = tab.icon
return <Icon className="w-4" />
})()}
<div>{tab.headerText}</div>
</div>
</SectionHeader>
)
}
return (
<TabContent className="flex-1 overflow-auto">
{/* API Configuration Tab */}
{activeTab === "api-config" && (
<div>
{renderSectionHeader("api-config")}
<Section>
{/* Tabs container */}
{planActSeparateModelsSetting ? (
<div className="rounded-md mb-5 bg-[var(--vscode-panel-background)]">
<div className="flex gap-[1px] mb-[10px] -mt-2 border-0 border-b border-solid border-[var(--vscode-panel-border)]">
<TabButton
isActive={chatSettings.mode === "plan"}
onClick={() => handlePlanActModeChange("plan")}>
Plan Mode
</TabButton>
<TabButton
isActive={chatSettings.mode === "act"}
onClick={() => handlePlanActModeChange("act")}>
Act Mode
</TabButton>
</div>
{/* Content container */}
<div className="-mb-3">
<ApiOptions
key={chatSettings.mode}
showModelOptions={true}
apiErrorMessage={apiErrorMessage}
modelIdErrorMessage={modelIdErrorMessage}
/>
</div>
</div>
) : (
<ApiOptions
key={"single"}
showModelOptions={true}
apiErrorMessage={apiErrorMessage}
modelIdErrorMessage={modelIdErrorMessage}
/>
)}
<div className="mb-[5px]">
<VSCodeCheckbox
className="mb-[5px]"
checked={planActSeparateModelsSetting}
onChange={(e: any) => {
const checked = e.target.checked === true
setPlanActSeparateModelsSetting(checked)
}}>
Use different models for Plan and Act modes
</VSCodeCheckbox>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
Switching between Plan and Act mode will persist the API and model used in the
previous mode. This may be helpful e.g. when using a strong reasoning model to
architect a plan for a cheaper coding model to act on.
</p>
</div>
<div className="mb-[5px]">
<VSCodeTextArea
value={customInstructions ?? ""}
className="w-full"
resize="vertical"
rows={4}
placeholder={
'e.g. "Run unit tests at the end", "Use TypeScript with async/await", "Speak in Spanish"'
}
onInput={(e: any) => setCustomInstructions(e.target?.value ?? "")}>
<span className="font-medium">Custom Instructions</span>
</VSCodeTextArea>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
These instructions are added to the end of the system prompt sent with every
request.
</p>
</div>
</Section>
</div>
)}
{/* General Settings Tab */}
{activeTab === "general" && (
<div>
{renderSectionHeader("general")}
<Section>
{chatSettings && (
<PreferredLanguageSetting
chatSettings={chatSettings}
setChatSettings={setChatSettings}
/>
)}
<div className="mb-[5px]">
<VSCodeCheckbox
className="mb-[5px]"
checked={telemetrySetting === "enabled"}
onChange={(e: any) => {
const checked = e.target.checked === true
setTelemetrySetting(checked ? "enabled" : "disabled")
}}>
Allow anonymous error and usage reporting
</VSCodeCheckbox>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
Help improve Cline by sending anonymous usage data and error reports. No code,
prompts, or personal information are ever sent. See our{" "}
<VSCodeLink
href="https://docs.cline.bot/more-info/telemetry"
className="text-inherit">
telemetry overview
</VSCodeLink>{" "}
and{" "}
<VSCodeLink href="https://cline.bot/privacy" className="text-inherit">
privacy policy
</VSCodeLink>{" "}
for more details.
</p>
</div>
</Section>
</div>
)}
{/* Feature Settings Tab */}
{activeTab === "features" && (
<div>
{renderSectionHeader("features")}
<Section>
<FeatureSettingsSection />
</Section>
</div>
)}
{/* Browser Settings Tab */}
{activeTab === "browser" && (
<div>
{renderSectionHeader("browser")}
<Section>
<BrowserSettingsSection />
</Section>
</div>
)}
{/* Terminal Settings Tab */}
{activeTab === "terminal" && (
<div>
{renderSectionHeader("terminal")}
<Section>
<TerminalSettingsSection />
</Section>
</div>
)}
{/* Debug Tab (only in dev mode) */}
{IS_DEV && activeTab === "debug" && (
<div>
{renderSectionHeader("debug")}
<Section>
<VSCodeButton
onClick={handleResetState}
className="mt-[5px] w-auto"
style={{ backgroundColor: "var(--vscode-errorForeground)", color: "black" }}>
Reset State
</VSCodeButton>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
This will reset all global state and secret storage in the extension.
</p>
</Section>
</div>
)}
{/* About Tab */}
{activeTab === "about" && (
<div>
{renderSectionHeader("about")}
<Section>
<div className="text-center text-[var(--vscode-descriptionForeground)] text-xs leading-[1.2] px-0 py-0 pr-2 pb-[15px] mt-auto">
<p className="break-words m-0 p-0">
If you have any questions or feedback, feel free to open an issue at{" "}
<VSCodeLink href="https://github.com/cline/cline" className="inline">
https://github.com/cline/cline
</VSCodeLink>
</p>
<p className="italic mt-[10px] mb-0 p-0">v{version}</p>
</div>
</Section>
</div>
)}
</TabContent>
)
})()}
</div>
<div className="grow overflow-y-scroll pr-2 flex flex-col">
{/* Tabs container */}
{planActSeparateModelsSetting ? (
<div className="border border-solid border-[var(--vscode-panel-border)] rounded-md p-[10px] mb-5 bg-[var(--vscode-panel-background)]">
<div className="flex gap-[1px] mb-[10px] -mt-2 border-0 border-b border-solid border-[var(--vscode-panel-border)]">
<TabButton isActive={chatSettings.mode === "plan"} onClick={() => handleTabChange("plan")}>
Plan Mode
</TabButton>
<TabButton isActive={chatSettings.mode === "act"} onClick={() => handleTabChange("act")}>
Act Mode
</TabButton>
</div>
{/* Content container */}
<div className="-mb-3">
<ApiOptions
key={chatSettings.mode}
showModelOptions={true}
apiErrorMessage={apiErrorMessage}
modelIdErrorMessage={modelIdErrorMessage}
/>
</div>
</div>
) : (
<ApiOptions
key={"single"}
showModelOptions={true}
apiErrorMessage={apiErrorMessage}
modelIdErrorMessage={modelIdErrorMessage}
/>
)}
<div className="mb-[5px]">
<VSCodeTextArea
value={customInstructions ?? ""}
className="w-full"
resize="vertical"
rows={4}
placeholder={'e.g. "Run unit tests at the end", "Use TypeScript with async/await", "Speak in Spanish"'}
onInput={(e: any) => setCustomInstructions(e.target?.value ?? "")}>
<span className="font-medium">Custom Instructions</span>
</VSCodeTextArea>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
These instructions are added to the end of the system prompt sent with every request.
</p>
</div>
{chatSettings && <PreferredLanguageSetting chatSettings={chatSettings} setChatSettings={setChatSettings} />}
<div className="mb-[5px]">
<VSCodeCheckbox
className="mb-[5px]"
checked={planActSeparateModelsSetting}
onChange={(e: any) => {
const checked = e.target.checked === true
setPlanActSeparateModelsSetting(checked)
}}>
Use different models for Plan and Act modes
</VSCodeCheckbox>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
Switching between Plan and Act mode will persist the API and model used in the previous mode. This may be
helpful e.g. when using a strong reasoning model to architect a plan for a cheaper coding model to act on.
</p>
</div>
<div className="mb-[5px]">
<VSCodeCheckbox
className="mb-[5px]"
checked={telemetrySetting === "enabled"}
onChange={(e: any) => {
const checked = e.target.checked === true
setTelemetrySetting(checked ? "enabled" : "disabled")
}}>
Allow anonymous error and usage reporting
</VSCodeCheckbox>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
Help improve Cline by sending anonymous usage data and error reports. No code, prompts, or personal
information are ever sent. See our{" "}
<VSCodeLink href="https://docs.cline.bot/more-info/telemetry" className="text-inherit">
telemetry overview
</VSCodeLink>{" "}
and{" "}
<VSCodeLink href="https://cline.bot/privacy" className="text-inherit">
privacy policy
</VSCodeLink>{" "}
for more details.
</p>
</div>
{/* Feature Settings Section */}
<FeatureSettingsSection />
{/* Browser Settings Section */}
<BrowserSettingsSection />
{/* Terminal Settings Section */}
<TerminalSettingsSection />
{IS_DEV && (
<>
<div className="mt-[10px] mb-1">Debug</div>
<VSCodeButton
onClick={handleResetState}
className="mt-[5px] w-auto"
style={{ backgroundColor: "var(--vscode-errorForeground)", color: "black" }}>
Reset State
</VSCodeButton>
<p className="text-xs mt-[5px] text-[var(--vscode-descriptionForeground)]">
This will reset all global state and secret storage in the extension.
</p>
</>
)}
<div className="text-center text-[var(--vscode-descriptionForeground)] text-xs leading-[1.2] px-0 py-0 pr-2 pb-[15px] mt-auto">
<p className="break-words m-0 p-0">
If you have any questions or feedback, feel free to open an issue at{" "}
<VSCodeLink href="https://github.com/cline/cline" className="inline">
https://github.com/cline/cline
</VSCodeLink>
</p>
<p className="italic mt-[10px] mb-0 p-0">v{version}</p>
</div>
</div>
</div>
{/* Unsaved Changes Dialog */}
<UnsavedChangesDialog
open={isUnsavedChangesDialogOpen}
onOpenChange={setIsUnsavedChangesDialogOpen}
onConfirm={handleConfirmDiscard}
onCancel={handleCancelDiscard}
/>
</Tab>
)
}
@@ -49,10 +49,7 @@ export const TerminalSettingsSection: React.FC = () => {
}
return (
<div
id="terminal-settings-section"
style={{ marginBottom: 20, borderTop: "1px solid var(--vscode-panel-border)", paddingTop: 15 }}>
<h3 style={{ color: "var(--vscode-foreground)", margin: "0 0 10px 0", fontSize: "14px" }}>Terminal Settings</h3>
<div id="terminal-settings-section" style={{ marginBottom: 20 }}>
<div style={{ marginBottom: 15 }}>
<div style={{ marginBottom: 8 }}>
<label style={{ fontWeight: "500", display: "block", marginBottom: 5 }}>
@@ -200,3 +200,39 @@ describe("OpenApiInfoOptions", () => {
expect(modelInput).toBeInTheDocument()
})
})
describe("ApiOptions Component", () => {
vi.clearAllMocks()
const mockPostMessage = vi.fn()
beforeEach(() => {
//@ts-expect-error - vscode is not defined in the global namespace in test environment
global.vscode = { postMessage: mockPostMessage }
mockExtensionState({
apiProvider: "nebius",
nebiusApiKey: "",
})
})
it("renders Nebius API Key input", () => {
render(
<ExtensionStateContextProvider>
<ApiOptions showModelOptions={true} />
</ExtensionStateContextProvider>,
)
const apiKeyInput = screen.getByPlaceholderText("Enter API Key...")
expect(apiKeyInput).toBeInTheDocument()
})
it("renders Nebius Model ID select with a default model", () => {
render(
<ExtensionStateContextProvider>
<ApiOptions showModelOptions={true} />
</ExtensionStateContextProvider>,
)
const modelIdSelect = screen.getByLabelText("Model")
expect(modelIdSelect).toBeInTheDocument()
expect(modelIdSelect).toHaveValue("Qwen/Qwen2.5-32B-Instruct-fast")
})
})
@@ -39,7 +39,7 @@ const WelcomeView = memo(() => {
<p>
I can do all kinds of tasks thanks to breakthroughs in{" "}
<VSCodeLink href="https://www.anthropic.com/claude/sonnet" className="inline">
Claude 3.7 Sonnet's
Claude 4 Sonnet's
</VSCodeLink>
agentic coding capabilities and access to tools that let me create & edit files, explore complex projects, use
a browser, and execute terminal commands <i>(with your permission, of course)</i>. I can even use MCP to
@@ -47,8 +47,8 @@ const WelcomeView = memo(() => {
</p>
<p className="text-[var(--vscode-descriptionForeground)]">
Sign up for an account to get started for free, or use an API key that provides access to models like Claude
3.7 Sonnet.
Sign up for an account to get started for free, or use an API key that provides access to models like Claude 4
Sonnet.
</p>
<VSCodeButton appearance="primary" onClick={handleLogin} className="w-full mt-1">
@@ -45,6 +45,7 @@ interface ExtensionStateContextType extends ExtensionState {
setCustomInstructions: (value?: string) => void
setTelemetrySetting: (value: TelemetrySetting) => void
setShowAnnouncement: (value: boolean) => void
setShouldShowAnnouncement: (value: boolean) => void
setPlanActSeparateModelsSetting: (value: boolean) => void
setEnableCheckpointsSetting: (value: boolean) => void
setMcpMarketplaceEnabled: (value: boolean) => void
@@ -55,6 +56,8 @@ interface ExtensionStateContextType extends ExtensionState {
setLocalClineRulesToggles: (toggles: Record<string, boolean>) => void
setLocalCursorRulesToggles: (toggles: Record<string, boolean>) => void
setLocalWindsurfRulesToggles: (toggles: Record<string, boolean>) => void
setLocalWorkflowToggles: (toggles: Record<string, boolean>) => void
setGlobalWorkflowToggles: (toggles: Record<string, boolean>) => void
setMcpMarketplaceCatalog: (value: McpMarketplaceCatalog) => void
// Navigation state setters
@@ -160,7 +163,8 @@ export const ExtensionStateContextProvider: React.FC<{
localClineRulesToggles: {},
localCursorRulesToggles: {},
localWindsurfRulesToggles: {},
workflowToggles: {},
localWorkflowToggles: {},
globalWorkflowToggles: {},
shellIntegrationTimeout: 4000, // default timeout for shell integration
isNewUser: false,
})
@@ -245,6 +249,7 @@ export const ExtensionStateContextProvider: React.FC<{
config.asksageApiKey,
config.xaiApiKey,
config.sambanovaApiKey,
config.nebiusApiKey,
].some((key) => key !== undefined)
: false
@@ -445,7 +450,8 @@ export const ExtensionStateContextProvider: React.FC<{
localClineRulesToggles: state.localClineRulesToggles || {},
localCursorRulesToggles: state.localCursorRulesToggles || {},
localWindsurfRulesToggles: state.localWindsurfRulesToggles || {},
workflowToggles: state.workflowToggles || {},
localWorkflowToggles: state.localWorkflowToggles || {},
globalWorkflowToggles: state.globalWorkflowToggles || {},
enableCheckpointsSetting: state.enableCheckpointsSetting,
// Navigation functions
@@ -490,7 +496,8 @@ export const ExtensionStateContextProvider: React.FC<{
...prevState,
mcpMarketplaceEnabled: value,
})),
setShowAnnouncement: (value) =>
setShowAnnouncement,
setShouldShowAnnouncement: (value) =>
setState((prevState) => ({
...prevState,
shouldShowAnnouncement: value,
@@ -540,6 +547,16 @@ export const ExtensionStateContextProvider: React.FC<{
...prevState,
localWindsurfRulesToggles: toggles,
})),
setLocalWorkflowToggles: (toggles) =>
setState((prevState) => ({
...prevState,
localWorkflowToggles: toggles,
})),
setGlobalWorkflowToggles: (toggles) =>
setState((prevState) => ({
...prevState,
globalWorkflowToggles: toggles,
})),
setMcpTab,
}
+36 -54
View File
@@ -1,7 +1,7 @@
import { useCallback } from "react"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { vscode } from "@/utils/vscode"
import { AutoApprovalSettings } from "@shared/AutoApprovalSettings"
import { updateAutoApproveSettings } from "@/components/chat/auto-approve-menu/AutoApproveSettingsAPI"
import { ActionMetadata } from "@/components/chat/auto-approve-menu/types"
export function useAutoApproveActions() {
@@ -35,7 +35,7 @@ export function useAutoApproveActions() {
// Toggle favorite status
const toggleFavorite = useCallback(
(actionId: string) => {
async (actionId: string) => {
const currentFavorites = autoApprovalSettings.favorites || []
let newFavorites: string[]
@@ -45,13 +45,10 @@ export function useAutoApproveActions() {
newFavorites = [...currentFavorites, actionId]
}
vscode.postMessage({
type: "autoApprovalSettings",
autoApprovalSettings: {
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
favorites: newFavorites,
},
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
favorites: newFavorites,
})
},
[autoApprovalSettings],
@@ -59,22 +56,22 @@ export function useAutoApproveActions() {
// Update action state
const updateAction = useCallback(
(action: ActionMetadata, value: boolean) => {
async (action: ActionMetadata, value: boolean) => {
const actionId = action.id
const subActionId = action.subAction?.id
if (actionId === "enableAutoApprove") {
updateAutoApproveEnabled(value)
await updateAutoApproveEnabled(value)
return
}
if (actionId === "enableAll" || subActionId === "enableAll") {
toggleAll(action, value)
await toggleAll(action, value)
return
}
if (actionId === "enableNotifications" || subActionId === "enableNotifications") {
updateNotifications(action, value)
await updateNotifications(action, value)
return
}
@@ -95,14 +92,11 @@ export function useAutoApproveActions() {
// Check if this will result in any enabled actions
const willHaveEnabledActions = Object.values(newActions).some(Boolean)
vscode.postMessage({
type: "autoApprovalSettings",
autoApprovalSettings: {
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
actions: newActions,
enabled: willHaveEnabledActions,
},
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
actions: newActions,
enabled: willHaveEnabledActions,
})
},
[autoApprovalSettings],
@@ -110,14 +104,11 @@ export function useAutoApproveActions() {
// Update max requests
const updateMaxRequests = useCallback(
(maxRequests: number) => {
vscode.postMessage({
type: "autoApprovalSettings",
autoApprovalSettings: {
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
maxRequests,
},
async (maxRequests: number) => {
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
maxRequests,
})
},
[autoApprovalSettings],
@@ -125,14 +116,11 @@ export function useAutoApproveActions() {
// Update auto-approve enabled state
const updateAutoApproveEnabled = useCallback(
(checked: boolean) => {
vscode.postMessage({
type: "autoApprovalSettings",
autoApprovalSettings: {
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
enabled: checked,
},
async (checked: boolean) => {
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
enabled: checked,
})
},
[autoApprovalSettings],
@@ -140,21 +128,18 @@ export function useAutoApproveActions() {
// Toggle all actions
const toggleAll = useCallback(
(action: ActionMetadata, checked: boolean) => {
async (action: ActionMetadata, checked: boolean) => {
let actions = { ...autoApprovalSettings.actions }
for (const action of Object.keys(actions)) {
actions[action as keyof AutoApprovalSettings["actions"]] = checked
}
vscode.postMessage({
type: "autoApprovalSettings",
autoApprovalSettings: {
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
actions,
enabled: checked,
},
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
actions,
enabled: checked,
})
},
[autoApprovalSettings],
@@ -162,15 +147,12 @@ export function useAutoApproveActions() {
// Update notifications setting
const updateNotifications = useCallback(
(action: ActionMetadata, checked: boolean) => {
async (action: ActionMetadata, checked: boolean) => {
if (action.id === "enableNotifications") {
vscode.postMessage({
type: "autoApprovalSettings",
autoApprovalSettings: {
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
enableNotifications: checked,
},
await updateAutoApproveSettings({
...autoApprovalSettings,
version: (autoApprovalSettings.version ?? 1) + 1,
enableNotifications: checked,
})
}
},
+13
View File
@@ -0,0 +1,13 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
/**
* A utility function that combines clsx and tailwind-merge to handle class name merging
* with proper Tailwind CSS conflict resolution.
*
* @param inputs - Class values to be merged
* @returns A string of merged class names
*/
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

Some files were not shown because too many files have changed in this diff Show More