Context Compression:
- auto-condense extended to all models with >=200K context window
- 500K+ context windows use 92% buffer (was conservative formula)
- added summarizeTaskLite template for <200K models
- fileOptimizationThreshold now configurable (default 0.3)
Multimodal Image Handling:
- auto-strip images when switching from vision to text-only models
- one-time notification per task session
- images preserved in history, auto-restored when switching back
Bug Fixes:
- fixed API errors when switching multimodal to text-only model mid-conversation
* fix(hooks): Run PreToolUse only after approval; get it working for read_file first
* fix(hooks): Run PreToolUse only after approval; get it working for six more tools now
* fix(hooks): Run PreToolUse only after approval; get it working for the remaining six tools now
* fix(hooks): Implement HookExecution type to avoid using 'any'
* feat(hooks): Initial implementation of hooks UI using background terminal UI
* Hooks UI improvements
* Hook discovery improvements
* Separate hooks UI into separate files
* Fix failing tests
* Add missing docs
* Hooks hardening and handling edge cases
* Improvements to hooks error messaging
* Improve TaskCancel hook UI
* Simplify and improve console.log() output from hooks
* Changes from usability feedback
* test: verify linting fixes
* fix: resolve cancel functionality in PostToolUse hook using flag pattern
* fix: add cancel button support for TaskResume and UserPromptSubmit hooks
* Getting things working again
* Fixing cancel behaviors
* Trying another fix
* Demoed
* Add examples to .clinerules/hooks/ directory
* Refactored away loadTaskStateWithoutWorkflow
* Fix unsafe return in finally block
Refactored PostToolUse hook execution to avoid using return statement
in finally block, which the linter flags as unsafe. Instead of early
return, wrapped the hook logic in a conditional check for abort status.
This resolves the biome lint error:
lint/correctness/noUnsafeFinally - Unsafe usage of 'return' in finally block
* Remove unnecessary files from branch
* remove cancelHookExecution() in favor of cancelTask()
* Remove unnecessary polling pattern for hook cancellation
* Fixing cancel behavior
* Fixing cancel behavior
* Fix resume
* Sqaush commits to improve merge tool behavior
Plan out the work needed to resolve race conditions
Fix race conditions (1)
Fix race conditions (2)
Fix race conditions (3)
Fix race conditions (4)
Fix race conditions (5)
Fix unit tests
Updated implementation plan doc
Code quality improvement
Temporary logging to troubleshoot race conditions in hooks UI blocks
Fix streaming output for hooks
Remove in-progress planning file
Revert breakage
Remove unneeded arg output in PreToolUse hook UI
Fix race condition with PreToolUse and PostToolUse hooks
Fix PreToolUse attempt_completion use case
Fix ChatTextArea prompt input
Fixed part of the rersume bug
Clean-up before code review
Change cancel button to abort button
Fixed TaskCancel behavior
Fixing resume behavior (partially fixed)
Make notch arrow visible in hooks block up expand/contract toggle
Prevent cancel/abort from clearing unsent user message
Change 'Cancelled' to 'Aborted' in hook UI block
Use color styles consistent with background terminal
Fix npm compile issue
Remove unneeded hot-cold tracking from hooks
Remove unused constant as per PR feedback
Minor changes
Skip combineHookSequences() if hooks feature setting not enabled
Improve mutex pattern for general use and fix additional race condition
Refactor to reduce duplication (keep it DRY)
Refactor to reduce duplication (keep it DRY) part 2
Fix tests
Skip some tests on Windows (not yet supported)
Hooks unsupported on Windows
Fix broken unit tests
* Fix broken unit tests
* Bee and Eve fixing 'API Request...' test in e2e tests
* Add comment as per ellipsis-dev PR feedback
* Changes as per PR feedback from Evan
* Remove if that always resolves to true
* Don't use vscode API; use cross-compatible solutions instead
* Remove mention of obsolete clineAsk handler
* (WIP)feat(api): add tool calling support to openai API handlers
Add ChatCompletionTool parameter to createMessage interface and implement tool calling functionality across API providers. Includes new StreamingToolCallHandler for processing tool call deltas and utility functions for converting tool specifications to OpenAI format.
* Replace path with absolutePath
* Simplify tool spec
* Parse stream and use variant matcher
* Simplify StreamingToolCallHandler
* Add CLINE_NEXT_GEN
* Enable parallel_tool_calls
* ApplyPatchHandler
* Simplify ApplyPatchHandler
* store tool use chunk
* feat(anthropic): add streaming tool use support with OpenAI-compatible format
Add comprehensive support for streaming tool use blocks from Anthropic API:
- Add tool_use case handler in AnthropicHandler to convert streaming tool
calls to OpenAI-compatible format during content block start events
- Implement ToolUseHandler class to accumulate and parse streaming tool use
deltas with incremental JSON parsing support
- Add proper handling for undefined tool message content in openai-format
converter to prevent errors
- Integrate ToolUseHandler into TaskState for managing streaming tool calls
across the request lifecycle
This enables real-time processing of tool calls as they stream from Anthropic's
API while maintaining compatibility with OpenAI's tool calling format.
* feat(anthropic): add tool support with OpenAI tool conversion
Add support for passing tools to Anthropic API with automatic conversion from OpenAI tool format. Implements tool_choice configuration to force tool usage when tools are provided.
Changes:
- Add tools parameter to createMessage method in AnthropicHandler
- Implement openAIToolToAnthropic converter to transform OpenAI ChatCompletionTool format to Anthropic Tool format
- Set tool_choice to "any" when tools are provided to ensure Claude uses one of the available tools
- Fix tool result handling to avoid invalid tool_use_id "cline" by converting to text blocks for backward compatibility
- Add documentation for tool_choice options (none, auto, any)
This enables proper tool calling functionality with Anthropic models while maintaining compatibility with the existing OpenAI tool definitions.
* oops
* fix: remove .mjs extensions from import paths
Remove `.mjs` file extensions from OpenAI and Anthropic SDK import paths to ensure compatibility with current module resolution. This updates imports across multiple files:
- openai/resources/chat/completions.mjs → openai/resources/chat/completions
- @anthropic-ai/sdk/resources/index.mjs → @anthropic-ai/sdk/resources/index
* revert styles.css change from merge main
* Update config and fix tests
* gpt-5 variant for cline provider only
* Fix GPT-5 web fetch tool
* Add native next gen for supported openai providers
* add native tool calling support to more openai comp providers
* list supported providers for gpt-5
* clean up
* Update ApplyPatchHandler
* clean up
* Update ask_followup_question
* Add system prompt test for cline claude 4.5 sonnet
* noToolsUsed
* Add support to gemini api provider
* add native tool calling to more providers
* Skip XML parsing
* clean up
* add back TASK_PROGRESS_PARAMETER to native tools
* feature flag NATIVE_TOOL_CALLS_NEXT_GEN_MODELS
* add allowNativeToolCalls to system prompt context
* add grok-code
* feat(context): ensure tool_result blocks follow tool_use blocks
Add validation to ensure every tool_use block in assistant messages has a corresponding tool_result in the following user message. When tool_result blocks are missing, they are automatically added with "result missing" content to maintain proper message pairing required by the Anthropic API.
This prevents API errors caused by orphaned tool_use blocks and ensures conversation history integrity after context management operations.
* feat(task): refactor ApplyPatchHandler to use FileEditProvider with revert support
Refactor the ApplyPatchHandler to use FileEditProvider and DiffViewProvider
for file operations instead of direct filesystem access. This change adds:
- State tracking for applied commits to enable rollback functionality
- Automatic revert of changes when user denies approval or errors occur
- Enhanced response format that includes full file contents after patching
- Consistent file reading through DiffViewProvider for better editor integration
- Proper cleanup of applied state after successful operations
This improves the patch application workflow by ensuring changes can be
safely reverted and provides better visibility into the applied changes.
The refactoring also aligns file operations with the existing editor
integration patterns used elsewhere in the codebase.
* Finalizing...
* MCP tools converter
* remove ClineDefaultTool.MCP_USE
* Update snapshot
* comments
* use diffViewProvider
* Fix MCP tool use with images
* fix mcp tool converter with reserved keys
* Fix apply patch streaming issue
* add vercel-ai-gateway to supported provider & clean up
* simplfy apply patch handler
* Turn off thinking when native tools are enabled for anthropic provider
* clean up ToolUseHandler
* anthropic tool_choice logic
* improve tool result ordering
- Extract anthropic message mapping logic into a separate variable for better readability
- Add MessageParam import from Anthropic SDK
- Update ensureToolResultsFollowToolUse to maintain tool_result order matching tool_use blocks
- Improve documentation to clarify tool result ordering requirements
This refactoring improves code maintainability by separating the message transformation logic and ensures tool results are properly ordered to match their corresponding tool use blocks in the conversation flow.
<budget:token_budget>200000</budget:token_budget>
* refactor tool result validation for improved efficiency
Simplify ensureToolResultsFollowToolUse method by streamlining the logic
for validating and reordering tool_result blocks. Changes include:
- Use early returns to reduce nesting and improve readability
- Process tool results and other blocks in a single pass instead of multiple iterations
- Eliminate unnecessary deep cloning by mutating content array directly
- Add flag-based update detection to avoid unnecessary array rebuilding
- Simplify the reordering logic while maintaining the same validation rules
This refactoring maintains the same functional behavior (ensuring tool_result
blocks follow their corresponding tool_use blocks) while reducing complexity
and improving performance through more efficient array operations.
<budget:token_budget>200000</budget:token_budget>
* attempt_completion
* use helper function
* remove FreeModelIDs from merge conflicts
* clean up
* Add NATIVE_GPT_5 & exclude gpt-5-chat
* shouldAutoApproveToolWithPath for apply patch
* add openai-native to supported provider
* add lightweight incremental chunk extraction
* update apply patch handler
* revert version regex
* Fix browser action
* add first version of auto-retry failed requests
Remove auto-retry as an option and do it by default for all errors that aren't credit issues for cline provider
Fix error retry showing for insufficient credits error
remove lastAutoRetryDelay
Fixes
Fixes
Fix
Fix
remove retrymessage for consistent UI
* Create lucky-mayflies-arrive.md
* Fix autoRetryAttempt counter not getting reset
* add grok coder free model to cline provider (#5808)
* add free grok-coder-free model to cline provider
* add changeset
* fix typo
* checkpoints class created
* Added saveCheckpoint to Checkpoint class
* Rebased and updated for new ClineMessages
* Moved things around, started on saveCheckpoint
* implemented handler for checking and initializing the checkpointTracker if not already done
* Moved restoreCheckpoint and handleSucessfullRestore to checkpoints class
* Moved presentMultiDiff, not yet connected
* Migrated doesLatestTaskCompletionHaveNewChanges and compelted migration on presentMultifileDiff
* Better init handling
* moved fileContextTracker to new checkpoints class
* Checkpoints state management
* refactoring and cleanup in saveCheckpoint, init handler
* More saveCheckpoint refactoring
* Added sayTs return to say function for better async clineMessages updates
* Refactor checkpoint system with timestamp tracking and dependency separation
* More refactoring
* Friendship ended with checkpointTracker, checkpointManager is new best friend
* Better error handling
* checkpointTrackerErrorMessage > checkpointManagerErrorMessage
* Addressed possible race condition with message(Ts)
* Better error handling and 15s timeout changes
* Remove checkpoint delegation methods and call checkpoint manager directly
* updating checkpoints protos
* cleanup
* Restored autoApprove entry to task class
* cleanup
* cleanup
* Post-rebase fixes
* Migrated timeout and state changes from PR #5015
* Extract toolExecutor callback functions to private methods for readability
* Updated info/error messages to use HostProvider
* post rebase fixes
* Compare/diff button fix
* Fix lint errors
* Update webview-ui/src/components/chat/task-header/TaskHeader.tsx
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
* Update src/integrations/checkpoints/index.ts
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
* Fixed bad merge, updated focus change for compatability with new say()
* Fixed error message propagation issue
---------
Co-authored-by: pashpashpash <nik@cline.bot>
Co-authored-by: Kevin Bond <kevin@Mac.hsd1.ca.comcast.net>
Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local>
Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
* base
* working state reduction & summarization flow wo duplicate calls
* stop injecting into user message
* focus on latest message
* edge case for cancelled stream post summarization tool call
* fix merge
* move apiConversationHistory to MessageStateHandler
* move clineMessages state to MessageStateManager class
* remove unused imports
* reorganize task class state variables and refactor out utility functions in recursivelyMakeClineRequests
* move task ephemeral state to state class
* extract tool logic into tool executor class
* integrate ToolExecutor into task class
* move apiConversationHistory to MessageStateHandler
* move clineMessages state to MessageStateManager class
* remove unused imports
* reorganize task class state variables and refactor out utility functions in recursivelyMakeClineRequests
* move task ephemeral state to state class (#4273)