Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
* fix: resolve Claude Code token counting inefficiency and enable caching (#5104)
- Remove 1.5x fudge factor from Claude Code token counting
- Enable prompt caching support for all Claude Code models
- Add comprehensive tests for token counting and caching
- Update existing tests to reflect accurate token counting
This fixes the extreme token inefficiency where simple messages would
jump from ~40k to over 60k tokens, causing API hangs when approaching
the artificial 120k limit. Claude Code now properly utilizes its full
200k context window with accurate token counting.
* fix: address PR review comments
- Extract IMAGE_TOKEN_ESTIMATE as a named constant for clarity
- Update token counting tests to use exact counts instead of ranges for deterministic testing
- Fix test expectations to match actual tokenizer output
* Remove token counting changes, keep only cache support
- Removed custom countTokens override from claude-code.ts
- Deleted claude-code-token-counting.spec.ts test file
- Kept cache token collection and reporting functionality
- Kept supportsPromptCache: true for all Claude Code models
- Kept claude-code-caching.spec.ts tests
This focuses the PR on enabling cache support without modifying token counting behavior.
* fix: update webview test to expect supportsPromptCache=true for Claude Code models
---------
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
* fix: resolve intermittent reasoning content not displayed for Claude Code provider (#5111)
- Modified fallback logic in stream parsing to handle all message types, not just assistant messages
- Added proper parsing attempts for partial data before yielding
- Improved error logging to help debug streaming issues
- Added debug logging (controlled by DEBUG_CLAUDE_CODE env var) to trace message types
This ensures reasoning/thinking content from Claude 3.5 Sonnet 4.0 is properly displayed in all cases.
* fix: disable reasoning budget UI controls for Claude Code provider (#5111)
- Set supportsReasoningBudget to false for all Claude Code models
- Claude Code CLI doesn't support thinking/reasoning parameters
- UI controls were misleading users since they had no effect
* fix: update Claude Code models configuration
- Add missing requiredReasoningBudget: false to claude-3-5-sonnet-20241022 and claude-3-5-haiku-20241022
- Revert run.ts changes as they are not needed for fixing the UI issue
- The UI issue is resolved by properly disabling reasoning budget support in model configuration
* feat: add reasoning effort support to Claude Code models and integrate into model selection
---------
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
This PR adds filtering of git repository properties from telemetry data and includes git info in telemetry properties, with comprehensive tests.
Behavior:
PostHogTelemetryClient now filters out repositoryUrl, repositoryName, and defaultBranch from telemetry events.
ClineProvider includes git repository information in telemetry properties, filtered by clients.
Functions:
Added isPropertyCapturable() in BaseTelemetryClient to allow property filtering.
Implemented getGitRepositoryInfo() and getWorkspaceGitInfo() in git.ts to extract git info.
Tests:
Added tests for isPropertyCapturable() in PostHogTelemetryClient.test.ts.
Added tests for getGitRepositoryInfo() and getWorkspaceGitInfo() in git.spec.ts.
Co-authored-by: Bruno Bergher <me@brunobergher.comexport>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
* Store the organization id in credentials
* Better organization logic
* Fix tests
* Update cloud settings defaults
* Fix organization_id handling in Clerk API calls
Address review feedback by properly handling 3 cases for organization_id:
1. Have an org id: send organization_id=THE_ORG_ID
2. Have a personal account: send organization_id= (empty string)
3. Don't know if you have an org id (old credentials): don't send organization_id param at all
Changes:
- Updated clerkCreateSessionToken() to check credentials.organizationId !== undefined
- Updated fetchUserInfo() to handle all 3 cases consistently
- Added fallback logic for old credentials without organization context
- Improved logging for better debugging of organization context
* DRY up organization loading code in AuthService
Extract common organization membership processing logic into reusable helper methods:
- findOrganizationMembership(): Find specific org membership by ID
- findPrimaryOrganizationMembership(): Get first/primary org membership
- setUserOrganizationInfo(): Set organization info on user object
This eliminates duplication between the two clerkGetOrganizationMemberships()
call sites that were doing very similar organization data processing.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
* Fixes#4882: Remove experimental setting for command execution in attempt_completion
- Remove DISABLE_COMPLETION_COMMAND from experiments system
- Permanently disable command execution in attempt_completion tool
- Update tool prompts to remove command parameter and examples
- Remove experimental UI toggle and localization entries (18+ languages)
- Update tests to reflect permanent behavior
- Remove experiment-specific test file
Command execution is now permanently disabled in attempt_completion.
Users must use execute_command tool separately before attempt_completion.
* refactor: simplify getAttemptCompletionDescription by removing unnecessary variables
* test: fix tests by regenerating snaps
---------
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
* Add reasoning budget support to Bedrock models and update related components
- Introduced `supportsReasoningBudget` property in Bedrock models.
- Enhanced `AwsBedrockHandler` to handle reasoning budget in payloads.
- Updated `ThinkingBudget` component to dynamically set max tokens based on reasoning support.
- Modified `ApiOptions` and `Bedrock` components to conditionally render `ThinkingBudget`.
- Added tests for extended thinking functionality in `bedrock-reasoning.test.ts`.
* Add BedrockThinkingConfig interface and update payload structure
* fix: address PR review feedback (#4481)
- Simplify ThinkingBudget ternary logic since component only renders when reasoning budget supported
- Break down complex thinking enabled condition with clear documentation
- Replace 'as any' usage with proper TypeScript interfaces for AWS SDK events
- Add comprehensive documentation for multiple stream structures explaining AWS SDK compatibility
* feat: show ThinkingBudget component unconditionally
Remove selectedProviderModels.length check to display ThinkingBudget
for all providers, not just those with available models
---------
Co-authored-by: hannesrudolph <hrudolph@gmail.com>
* Add reasoning budget support to Bedrock models and update related components
- Introduced `supportsReasoningBudget` property in Bedrock models.
- Enhanced `AwsBedrockHandler` to handle reasoning budget in payloads.
- Updated `ThinkingBudget` component to dynamically set max tokens based on reasoning support.
- Modified `ApiOptions` and `Bedrock` components to conditionally render `ThinkingBudget`.
- Added tests for extended thinking functionality in `bedrock-reasoning.test.ts`.
* Add BedrockThinkingConfig interface and update payload structure
* fix: address PR review feedback (#4481)
- Simplify ThinkingBudget ternary logic since component only renders when reasoning budget supported
- Break down complex thinking enabled condition with clear documentation
- Replace 'as any' usage with proper TypeScript interfaces for AWS SDK events
- Add comprehensive documentation for multiple stream structures explaining AWS SDK compatibility