- Add CreateApprovalWithToolUseID method to approval manager
- Extract session ID from X-Session-ID header in MCP requests
- Handle auto-approval for dangerously_skip_permissions flag
- Fix approval creation to include comment field in SQLite store
- Wire up MCP server with approval manager in daemon HTTP server
- Kept debugLogSnapshotFailure function and logger import uncommented
- Function invocation remains commented in catch block
- Added proper ESLint and TypeScript ignore comments for unused function
- Cleaner approach that keeps debug code readily available
The Claude API returns permission_denials as an array of objects with
tool_name, tool_use_id, and tool_input fields, but the SDK expected
a simple string array. This type mismatch caused JSON unmarshaling
failures that incorrectly marked successful sessions as FAILED.
- Add PermissionDenial struct and PermissionDenials wrapper type
- Implement custom UnmarshalJSON to handle both object and string formats
- Update StreamEvent and Result structs to use the new type
- Add missing PermissionDenials field copy in Result builder
- Add comprehensive tests for all permission denial formats
Fixes sessions being incorrectly marked as FAILED when they contain
permission denials but complete successfully (e.g., session C5E8CF80
which created PR #430 successfully but showed as failed).
- Commented out entire debug function as block comment
- Logger import also commented to avoid unused import
- Clean approach that preserves debug code for future use
- All checks now pass (lint, typecheck, format)
- Created debugLogSnapshotFailure helper function with original logging logic
- Commented out just the function invocation instead of entire code block
- Kept logger import active for potential future use
- Cleaner approach that preserves debug capability without code clutter
- Hide 'Brainrot Mode' until user types 'brain' in search
- Show context-aware 'Archive'/'Unarchive' label based on session state
- Improves UI clarity and reduces clutter in command palette
Replace stub MCP handler with full implementation using mark3labs/mcp-go v0.37.0
library. The new server provides complete MCP protocol support with proper
JSON-RPC handling, tool schema generation with annotations, and session ID
extraction from headers.
Key changes:
- Add mark3labs/mcp-go dependency for MCP protocol implementation
- Create MCPServer with request_approval tool and auto-deny mode
- Update daemon to use new MCP server instead of stub
- Add proper context key type to satisfy linter requirements
- Extract session IDs from X-Session-ID and Mcp-Session-Id headers
- Add comprehensive integration tests for schema validation and edge cases
The server is configured as stateless for Phase 3, with approval manager
integration coming in Phase 4. Auto-deny mode (MCP_AUTO_DENY_ALL=true)
enables predictable testing without requiring approval infrastructure.
Tested with curl commands and integration test suite (40 tests passing).
- Rename TestMigration12_ToolUseID to TestMigration14_ToolUseID to match actual migration number
- Fix defer Close() to ignore error per linter recommendation
Extend the approvals table to store tool_use_id for direct correlation between
tool calls and approvals. This eliminates the race condition issue when matching
approvals to tool executions.
Changes:
- Add tool_use_id column to approvals table schema
- Add migration 12 to update existing databases
- Create index for efficient tool_use_id lookups
- Update CreateApproval and GetApproval methods to handle tool_use_id
- Populate tool_use_id for existing approvals from conversation_events
The tool_use_id provides a direct 1:1 mapping between Claude's tool calls
and approval requests, removing the need for indirect correlation via
session_id + tool_name matching.
Add a minimal HTTP endpoint at /api/v1/mcp that implements basic MCP protocol support.
This phase creates the foundation for migrating from stdio-based MCP to HTTP-based
communication directly with the daemon.
Changes:
- Create minimal MCP stub handler that responds to initialize and tools/list
- Mount endpoint at /api/v1/mcp in daemon HTTP server
- Add integration tests to verify endpoint functionality
- Support auto-deny mode via MCP_AUTO_DENY_ALL env var for testing
The stub handler provides a working MCP endpoint that can be verified with
MCP Inspector while we build out the full implementation in subsequent phases.
- Add title field to CreateSession API endpoint
- Update SDK and client libraries to support title parameter
- Add title input to UI session launcher
- Add --title flag to CLI launch command
- Store and display custom titles instead of using query as title
- Fix claudecode-go to pass query as positional argument with --print flag
- Allow failed sessions with claude_session_id to be resumed in backend
- Add debug logging for failed session resumption attempts
- Update integration tests to match new behavior allowing failed sessions
- Remove unnecessary session status restrictions in frontend components
The archivedOnly parameter was not being passed from the HTTP client
adapter to the underlying SDK, causing archive view to show all sessions
instead of just archived ones. This regression was introduced in 436e4a1
when the previous fix from PR #394 was inadvertently reverted.
- Fix session ID extraction from assistant/user messages
- Process token updates even without Claude session ID
- Skip incorrect cumulative token counts from result events
- Update UI to reflect real-time token changes in active session
- Publish token update events to keep UI in sync
The API sends result events with cumulative cache read tokens that incorrectly accumulate across the entire session. This fix only trusts token counts from individual assistant messages which are accurate.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Kept upstream's migration 12 for model_id column
- Moved token tracking fields to migration 13
- Regenerated server.gen.go from OpenAPI spec
- All GetSession queries already include model_id field
* Add model_id to stored session fields
* feat(wui): add stacked cards component and demo
Create a reusable StackedCards component inspired by Sonner's toast stacking,
with smooth animations for card dismissal and stack reorganization.
- Add StackedCards component with configurable gap and visible card count
- Implement smooth scale and translate animations for stacking effect
- Create demo page at /demo/stacked_cards with interactive controls
- Cards stack with negative Y offset to show peeking effect
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: Add database info to debug panel with improved layout
- Add REST API endpoint /api/v1/database-info to expose SQLite stats
- Implement GetDatabaseInfo handler with file size, counts, and metadata
- Add helper methods to SQLiteStore for session/approval/event counts
- Update debug panel with wider grid layout (max-w-3xl)
- Display database path, size, table counts, and statistics in organized grid
- Add copy button for database path
- Remove unused RPC implementation in favor of REST endpoint
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* post cherry-pick regen
* Couple additional goodies from 166411c4a6
* mct; includes fix for permission_denials
---------
Co-authored-by: Claude <noreply@anthropic.com>
- Add proper escape key handling to back out of modals and session detail view
- Fix ESC key in bypass permissions dialog to blur input instead of closing modal
- Implement hotkey scope stealing for modals to prevent background hotkey conflicts
- Add SessionDetailHotkeysScope to all session detail hooks for proper scope management
- Prevent modal stacking by checking active scopes before opening modals (alt+y, cmd+y)
- Fix tool result modal scope cleanup to prevent stuck states blocking global hotkeys
- Improve escape key cascade: blur inputs → clear confirmations → unfocus → close view
- Handle escape key properly when fork view and other modals are open
- Clean up debug logging from development
The test was expecting 150500 but the calculation is:
- Input tokens: 500
- Output tokens: 300
- Cache read tokens: 150000
- Total: 150800
This test was not caught earlier because it only runs with -tags=integration
- Track input, output, cache creation, and cache read tokens in sessions
- Calculate and store effective context tokens (sum of all token types)
- Add context limit management with default of 168k tokens
- Display token usage badge in UI with visual warnings at 60% and 90%
- Update OpenAPI spec and regenerate TypeScript SDK types
- Add database migrations for new token tracking columns
Remove "-test" suffix from nightly version to ensure release notes
correctly show "codelayer-nightly" in installation instructions.
The conditional expression in release notes was already correct,
but the version format included an extra "-test" suffix causing
the condition to match incorrectly.
- Add terminal color palettes for all 14 themes (colors 0-15)
- Create ANSI parser utility to convert escape sequences to styled React components
- Integrate selective ANSI rendering for Bash tool outputs only
- Preserve colors in inline previews using CSS truncation
- Add comprehensive unit tests for ANSI parsing
- Other tools preserve raw ANSI codes for debugging purposes
- Remove glow effect, add color cycling on bounce instead
- Cycles through theme colors: accent, accent-alt, success, error, warning
- Add per-session localStorage persistence (each session remembers its state)
- Ensure proper contrast with background color on all themes
Implements a DVD screensaver-style bouncing box that displays the current
tool name from the active Claude session. The feature is accessible via
the command palette (Cmd+K) when viewing a session detail.
- Add DvdScreensaver component with physics-based bouncing animation
- Integrate with command palette, showing option only on session detail
- Add fuzzy search support for command palette options
- Auto-close command palette after selecting brainrot mode
- Ensure DVD box only appears when viewing session details
- Display tool names like "Assistant", "Bash", "Edit", "Thinking"