This feature include the following changes:
- Implemented llm/compileChat that gives the webview the ability to precompile the chat messages
before sending them to llm/streamChat where the webview can gather the pruning information and
provide users better guides.
- Added a optional parameter to llm/streamChat that can be used to indicate whether the chat
messages being passed is procompiled or not, so we don't compile the chat messages twice.
Because it's an optional parameter, we don't affect the behavior of llm/stream when it's
called at other places.
- Added a warning message box for the last ContinueInputBox which will display the warning
messages and also provide some useful guides.
https://github.com/Granite-Code/granite-code/issues/22
- Fixed utility functions to find tool calls in correct assistant message instead of last history item
- Enhanced PendingToolCallToolbar to handle individual tool call actions properly
- Added comprehensive tests for multiple tool call scenarios
- Consolidated tool call selectors into single file with cleaner naming
- Added mock support for tools/call endpoint to enable proper testing
- Fixed streamResponseAfterToolCall to wait for all parallel tool calls before continuing
This resolves the issue where accepting/rejecting one tool call would cause other pending tool calls to disappear from the UI.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Key Issues Fixed
### 1. Tool Output Matching Error
- **Problem**: `compileChatMessages` only processed the last tool message, causing "no tool call found to match tool output" errors
- **Solution**: Modified to collect and process all consecutive tool messages from the end
- **Files**: `core/llm/countTokens.ts` - Enhanced tool message collection and validation logic
### 2. Claude API Missing tool_result Blocks
- **Problem**: `flattenMessages` was merging adjacent tool messages, losing individual `toolCallId` properties
- **Solution**: Prevented merging of tool messages to preserve unique `toolCallId` for each `tool_result` block
- **Files**: `core/llm/messages.ts` - Added condition to prevent tool message merging
### 3. Token Counting for Parallel Tool Calls
- **Problem**: Token counting only considered the last tool message
- **Solution**: Added logic to count tokens for all tool messages in parallel scenarios
- **Files**: `core/llm/countTokens.ts` - Enhanced token counting for multiple tool messages
## Test Coverage
- Added comprehensive tests for parallel tool call scenarios
- Tests verify correct message structure for Claude API format
- All existing functionality preserved with backward compatibility
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Reverted ID-based streaming logic back to index-based approach
- Reverted permission processing changes
- Preserved existing parallel tool calls infrastructure
- Tests show tool calls are stored but not transitioning to "generated" status
- Ready to start fresh on the parallel tool calling issue
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix findCurrentToolCalls to prioritize toolCallStates array over single toolCallState
- Remove all backward compatibility code for single toolCallState field
- Update clearDanglingMessages to only use toolCallStates array
- Clean up utility function tests to only test new behavior
- Add comprehensive test coverage for parallel tool calls functionality
- Suppress ProseMirror DOM errors in test environment
- Fix TypeScript errors in test files
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Changed from selectCurrentToolCall to selectCurrentToolCallsByStatus
- Show individual UI for each tool call requiring approval
- Display dynamic text: "1 pending tool call" vs "X pending tool calls"
- Individual approve/reject buttons for each tool call
- Added test IDs with toolCallId for specific tool testing
- Used only Tailwind classes, no styled components
- Returns null when no pending tool calls exist
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Renamed function from callCurrentTool to callToolById to better reflect its purpose
- Updated function signature to accept toolCallId parameter for parallel tool execution
- Renamed file from callCurrentTool.ts to callToolById.ts
- Updated all import paths and call sites across codebase
- Verified TypeScript compilation passes
- All utility function tests still pass (21/21)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
previously, edit mode was triggered even without an active editor and
the existing fallback mechanism failed silently if no active editor was
available.
this commit ensures that there is a validation check before entering
edit mode to ensure codeToEdit exists. It shows a toast message when
trying to switch to edit mode using '⌘I'. It also removes the fallback
check that occurs after edit mode is already activated.
pressing ⌘I in chat mode to switch to edit mode when no editor is
focused previously led to an unrecoverable error state in the secondary
sidebar.
this commit ensures that ⌘I action does nothing unless an editor is
focused, preventing the ui from freezing and allowing normal interaction
with the panel.