5fde21dffd7fe3f2375ce5fa46256a78138a7ecd
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5fde21dffd |
native tool calling (#6921)
* (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 |
||
|
|
ee1bb2f788 |
Support Feature Flags default values (#7027)
* Support Feature Flags default values * Update src/services/feature-flags/FeatureFlagsService.ts Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com> * Update FeatureFlag support for unknown values * refactor isFeatureFlagEnabeld --------- Co-authored-by: Bee <68532117+abeatrix@users.noreply.github.com> |
||
|
|
3846e3fca0 |
Remove MULTI_ROOT_WORKSPACE feature flag (#6808)
* Remove MULTI_ROOT_WORKSPACE feature flag The multi-root workspace feature is now rolled out to 100% of users, so the feature flag is no longer needed. Changes: - Removed MULTI_ROOT_WORKSPACE from FeatureFlag enum - Removed getMultiRootEnabled() method from FeatureFlagsService - Updated isMultiRootEnabled() to only check user setting - Set multiRootSetting.featureFlag to true (always enabled) - Updated tests to remove feature flag stubs * Add changeset for multi-root feature flag removal |
||
|
|
b7a5e3290a |
Add hooks feature flag (#6734)
* Add hooks feature flag * Re-apply the feature flag changes * Add missing detail about setting state |
||
|
|
8d2ee1dffb | do_nothing feature flag (#6712) | ||
|
|
1cee9f33a7 | feat: feature flag for cline auth provider (#6629) | ||
|
|
b71f0ddbfb |
Fixed issue with focus chain settings (#6170)
Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local> |
||
|
|
1b08f23f87 |
Add Active Workspaces info to system information and adding feature flag for multi root (#6128)
* Add Active Workspaces info to system information Update system_info.ts to include active workspaces in the system prompt, providing AI assistants with context about all currently open workspace directories. This enhancement helps the AI understand the full scope of the user's development environment beyond just the current working directory. * add changeset * Add Active Workspaces info to system information Update system_info.ts to include active workspaces in the system prompt, providing AI assistants with context about all currently open workspace directories. This enhancement helps the AI understand the full scope of the user's development environment beyond just the current working directory. * add changeset * Update test for single workspace * IS_TEST * Adding MultiRoot support scaffolding to tasks and adding support for multi root checkpoint manager * Adding MultiRoot support scaffolding to tasks and adding support for multi root checkpoint manager * Adding MultiRoot support scaffolding to tasks and adding support for multi root checkpoint manager * Adding MultiRoot support scaffolding to tasks and adding support for multi root checkpoint manager * Adding MultiRoot support scaffolding to tasks and adding support for multi root checkpoint manager * Adding MultiRoot support scaffolding to tasks and adding support for multi root checkpoint manager * Refactor feature flags to use centralized service instead of state manager - Replace direct state manager access with featureFlagsService calls - Remove feature flag polling from webview initialization - Move feature flag polling to main initialization flow - Centralize focus chain feature flag logic in FeatureFlagsService * Update system prompt snapshots --------- Co-authored-by: Arafatkatze <arafat.da.khan@gmail.com> |
||
|
|
2c866c9265 |
Refactor posthog service providers and centralize distinct ID management (#5705)
* Refactor services architecture with provider pattern and factory classes - Extract telemetry, error handling, and feature flags into separate service modules - Implement provider pattern with factory classes for better abstraction - Move PostHog-specific implementations to dedicated provider classes - Add interfaces for telemetry, error, and feature flags providers - Update imports across codebase to use new service structure - Add unit tests for telemetry service * Refactor service providers and centralize distinct ID management - Move provider interfaces to dedicated providers/ subdirectories - Extract distinct ID management to shared logging/distinctId module - Simplify PostHogClientProvider by removing distinct ID parameter - Update service factories to use centralized distinct ID - Reorganize test files to __tests__/ directories - Remove redundant distinct ID handling across services * merge main * clean up * add grok coder free model to cline provider (#5808) * add free grok-coder-free model to cline provider * add changeset * fix typo * v3.26.6 Release Notes (#5788) * changeset version bump * Updating CHANGELOG.md format * Update CHANGELOG.md for version 3.26.6 with user-friendly descriptions --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: pashpashpash <nik@cline.bot> * Remove top padding from ActionButtons component (#5806) Eliminate unnecessary top padding in the chat view. * removing middle out from params to or / cline providers (#5811) * Dify.ai integration (#5761) * add focus chain settings to statemanager initialize function (#5798) * add custom gpt-5 system prompt (#5757) * gpt-5 system prompt * add changeset * Focus chain telemetry tweaks (#5810) Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local> * Remove eslint-rules test patterns from Mocha spec configuration (#5812) Update the "spec" array in .mocharc.json to exclude "eslint-rules/__tests__/**/*.test.ts", as that directory has been removed. * Increase horizontal margin in AutoApproveBar component (#5813) Update the mx-[5px] to mx-[15px] in the div's className to adjust horizontal spacing for improved layout alignment. * fix: remove hardcoded Ollama host from options (#5816) * fix: remove hardcoded Ollama host from options Updates the Ollama handler to remove the hardcoded "http://localhost:11434" as the `ollamaBaseUrl` fallback option for the host to allow the Ollama SDK to handle the default endpoint configured on users' machine. Reason: Ollama allows cross-origin requests from 127.0.0.1 and 0.0.0.0 by default. However, when we use localhost, the browser would resolve it through DNS, which can result in different IP addresses. Docs: https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-expose-ollama-on-my-network * add changeset * deep-planning prompt PowerShell (#5699) * Windows/Powershell specific deep planning prompt changes * Prompt adjustments --------- Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local> * Changes to condenseToolResponse & summarizeTask prompting (#5817) * Condense & deep planning prompt adjustments * Removed ps prompting ready for PR * rebase * Fixed typo on one word --------- Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local> * rename CacheService to StateManager (#5681) * rename CacheService to StateManager * fix types * infer state key types from existing interfaces (#5815) * fix: AutoApproveModal positioning and scrolling behavior (#5819) * fix: AutoApproveModal positioning and scrolling behavior - Add dynamic positioning calculation to prevent modal overflow - Implement proper flex layout with scrollable content container - Ensure minimum usable height and top margin constraints - Fix modal positioning when button is near viewport edges * Add changeset * clean up * template-based system prompt (#5731) * Refactor system prompt architecture with new template-based system - Move existing system prompt files to legacy directory - Implement new modular system with PromptBuilder, PromptRegistry, and TemplateEngine - Add component-based prompt structure with reusable parts (capabilities, rules, tool_use, etc.) - Create variant-specific templates for generic and next-gen models - Add comprehensive test suite with snapshots for different model configurations - Introduce template engine with placeholder support for dynamic prompt generation * Refactor system prompt architecture with modular tool definitions - Extract tool specifications into dedicated modules under tools/ - Add ClineToolSet class for managing tool variants by model family - Restructure prompt components with centralized index exports - Update prompt builder and registry to support new tool architecture - Reorganize shared utilities and type definitions - Update all test snapshots to reflect new prompt structure * Update snapshots * reorg * Update template format * clean up * typos * focus chain section * fix task progress in attempt_completion * Implement tool retrieval with fallback options in PromptBuilder - Added `getToolByNameWithFallback` and `getToolsForVariantWithFallback` methods to `ClineToolSet` for improved tool resolution. - Updated `getToolsPrompts` in `PromptBuilder` to utilize these new methods, allowing for better handling of tool requests with fallback to generic tools. - Enhanced sorting and filtering of tools based on context requirements and requested order. * update fild structure * clean up * fix static test string * Update snapshot names * Update unit test * Remove unused placeholders and update docs * Update README on how to add new tool * Remove task_progress reference from attempt_completion tool description when focus chain is disabled * Upgrade posthog-node to v5.8.0 and add exception filtering - Update posthog-node from v4.8.1 to v5.8.0 - Add EventMessage import for type safety - Implement posthogEventFilter to only capture exceptions from Cline extension - Filter exceptions by checking for "cline" in error messages or "saoudrizwan" in stack frames * Use env var keys - Add PostHogClientConfig to ErrorProviderFactory with proper validation - Update PostHogErrorProvider to use dedicated client instead of shared one - Add API key validation in PostHogFeatureFlagsProvider before client creation - Enhance error handling with fallback to NoOpErrorProvider instead of throwing - Standardize configuration passing across telemetry, error, and feature flag services * Upadte filter * update filter * update imports * use secret * disable enableExceptionAutocapture * removes vscode.env.machineId * initializeDistinctId * use get trap as workaround * on exit --------- Co-authored-by: pashpashpash <nik@cline.bot> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Toshii <94262432+0xToshii@users.noreply.github.com> Co-authored-by: Yunus Emre AYHAN <ayhanyunusemre@gmail.com> Co-authored-by: celestial-vault <58194240+celestial-vault@users.noreply.github.com> Co-authored-by: canvrno <46584286+canvrno@users.noreply.github.com> Co-authored-by: Kevin Bond <kevin@Kevins-MacBook-Pro.local> |