Previously shared one McpServer instance across all sessions/transports,
which caused Protocol._transport to be overwritten when new sessions
connected. This broke message routing for requests on previous transports
after long-running SSE streams.
Now creates a new McpServer instance per session, following the stateful
session pattern from the MCP SDK documentation. Each session gets its own
server+transport pair, preventing transport reference conflicts.
Fixes issue where get_agent_status would fail after wait_for_agent completed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This fixes two root causes of MCP tool calls hanging indefinitely:
1. Transform ensureValidJson from validator to transformer
- Previously threw errors on undefined values, causing handlers to crash
- Now converts undefined→null, Date→ISO string, bigint→string, etc.
- Ensures all MCP handlers always return valid JSON responses
2. Cancel waitTracker when interrupting agents
- Added waitTracker.cancel() in cancel_agent handler
- Added waitTracker.cancel() in kill_agent handler
- Resolves waiting wait_for_agent promises when agents are interrupted
- Prevents indefinite hangs requiring server restart
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add structured output matching StructuredToolResult type for Codex
apply_patch operations when parsing rollout files. This enables the
frontend to render file edit diffs for restored Codex sessions, matching
the behavior of Claude agent file edits.
Note: For live streaming, the Codex SDK only provides file_change events
with {path, kind} without actual patch content. The structured diffs are
only available for restored sessions via rollout file parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Codex SDK uses aggregated_output and exit_code fields for command
execution results (not output). Build structured output matching
StructuredToolResult type so frontend renders Codex commands the
same way as Claude commands.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove all heuristic parsing code from message.tsx (hasCommandDetails,
commandSection, editSections, readSections, hasStructuredContent, etc.)
- Replace with simple raw JSON fallback for tools without structured results
- Fix server-side support for Claude SDK's old_string/new_string params
(in addition to old_str/new_str)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Server-side:
- Add StructuredToolResult discriminated union type with command, file_write,
file_edit, file_read, and generic variants
- Implement buildStructuredToolResult in claude-agent.ts to detect tool types
and emit properly structured results
- Update codex-agent.ts to emit structured command results
Client-side:
- Add type guard and extraction functions for structured results
- Render tool calls based on result.type when available:
- command: show command, output, exit code
- file_write/file_edit: show diff viewer with proper +/- format
- file_read: show file content
- generic: show raw JSON
- Fall back to heuristic parsing for backwards compatibility
This fixes file writes showing as "Command: success message" - they now
properly show as diffs with +line additions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Relative paths like "." resolve differently depending on where the
server is started, causing agent history files to be stored under
different directories. This fixes the empty state issue when loading
agents created with relative paths.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The Claude SDK returns tool_result blocks with `content` as a string
containing the actual command output. Previously, handleToolResult only
set output when there were file changes (entry?.files), missing all
other tool outputs like shell command results.
Now buildToolOutput extracts block.content and wraps it as
{ result: { output: content } } which the frontend parsers expect.
This fixes "No additional details available" when expanding tool calls.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove the `raw` field that was duplicating provider data in timeline
items, reducing WebSocket payload sizes by 64-85%:
- session_state: ~320KB → ~48KB
- agent_stream_snapshot: ~320KB → ~114KB
Changes:
- Remove raw from AgentTimelineItem, AgentStreamEvent, AgentPermissionRequest
- Remove raw assignments from claude-agent.ts and codex-agent.ts
- Remove provider_event handling from stream.ts (only used for Codex raw)
- Update tests to reflect new behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Skip dispatching individual agent_stream events when replaying history
(the snapshot is sent after priming anyway, so individual events were wasted)
- Add WebSocket message logging on client (type, size, id) for debugging
- Change default daemon URL from dev to localhost
- Clean up unused imports in session.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Ensures MCP-originated prompts emit timeline events in real-time by calling recordUserMessage before starting agent runs. Fixes issue where messages sent via MCP tools only appeared after page refresh.
- Add recordUserMessage call in send_agent_prompt tool
- Add recordUserMessage call in create_coding_agent with initialPrompt
- Both paths now mirror UI-sent message behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed a state management bug where clicking the checkmark in create agent dictation mode would not trigger processing. The issue was that setIsDictationProcessing(true) was called after stopping the recorder, causing a race condition where the UI never showed the processing state.
Changes:
- Move setIsDictationProcessing(true) to execute immediately at the start of the confirm handler
- Add proper cleanup when audioData is null
- Ensure UI shows loading spinner when checkmark is clicked
This aligns the create agent dictation behavior with the working agent chat dictation implementation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add cancel button during agent runs, real-time mode toggle in all states, and agent deletion via long-press action sheet. Server now handles cancel_agent_request and delete_agent_request messages, cleaning up agent state and notifying clients.
Replace separate ACP and agent-types modules with unified AgentManager using provider pattern. Migrate Claude and Codex implementations to provider-specific clients. Streamline session-agent integration, remove old ACP notification types, and introduce agent timeline events. Delete obsolete documentation and test files. Add AgentRegistry for persistence and agent-stream-based communication pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Simplify agent-prompt.md with clearer delegation rules and workflow
- Add blockquote markdown styling to message component
- Update agent type to support both claude and codex agents
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add git diff viewer screen accessible via agent dropdown menu
- Implement git_diff_request/response WebSocket messages
- Add dropdown menu to agent screen header with "View Changes" option
- Clear pending permissions when starting new agent turn to prevent conflicts
- Treat agent refusals as completed rather than failed state
- Add test coverage for permission handling edge cases
- Configure vitest to run in single-threaded mode for stability
- Remove redundant wrapper in agent stream view
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace @gorhom/bottom-sheet with React Native's native Modal component and implement custom slide-in/slide-out animations using Reanimated. This provides better control over modal behavior and animations while reducing dependency on external libraries.
Key changes:
- Replace BottomSheetModal with native Modal component
- Implement custom slide animations using Reanimated shared values
- Add backdrop fade in/out animations
- Extract modal sections into focused components (ModalHeader, WorkingDirectorySection, AssistantSelector, ModeSelector, WorktreeSection)
- Add responsive layout support with compact/wide screen detection
- Fix keyboard animation to use transform instead of padding
- Improve modal lifecycle management with mount/unmount state tracking
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Simplify agent screen layout by removing redundant status bar container and consolidating all footer controls into the input area component. Add smooth fade animations for realtime mode transitions and a floating scroll-to-bottom button for better UX.
Changes:
- Consolidate status bar and controls into AgentInputArea for cleaner layout hierarchy
- Add scroll-to-bottom button to AgentStreamView with fade animations
- Fix realtime controls stacking on non-agent screens
- Add lastActivityAt serialization to MCP server agent responses
- Remove unnecessary layout wrapper in agent screen
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add worktree utility functions for git worktree management
- Fix stale closure issue in create-agent-modal causing worktreeName to not be sent
- Refactor create-agent-modal to use useCallback for all functions in proper order
- Add tilde path expansion before worktree creation to fix "Not in a git repository" error
- Add worktreeName parameter to create_agent_request WebSocket message
- Add debug logging for worktree creation flow
- Remove noisy logging (message chunk updates, session updates, agent update notifications)
The worktree feature allows creating isolated git worktrees for each agent,
enabling work on different branches simultaneously without conflicts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
When a user accepts an ExitPlanMode permission, the agent sends a
current_mode_update notification. Previously this was only forwarded
as an agent_update message, but the frontend relies on agent_status
messages to update the mode selector UI.
Now we detect current_mode_update notifications and emit an additional
agent_status message immediately, ensuring the UI updates without
waiting for the agent to complete its turn.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>