Commit Graph

89 Commits

Author SHA1 Message Date
Mohamed Boudra
36facf4bfd Fix MCP server: create separate McpServer instance per session
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>
2025-11-29 21:39:46 +00:00
Mohamed Boudra
6b9fbb83c0 Fix MCP request hangs caused by agent interruption
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>
2025-11-29 11:41:11 +00:00
Mohamed Boudra
7c1517d830 feat(server): add Playwright MCP with headless mode to spawned Claude agents
Spawned agents now get Playwright browser automation capabilities by default.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 05:08:56 +00:00
Mohamed Boudra
4311c3aebd feat(codex): add structured file edit output with diffs for restored sessions
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>
2025-11-28 19:57:46 +00:00
Mohamed Boudra
bf04b7d5df fix(codex): use aggregated_output for structured command results
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>
2025-11-28 19:46:55 +00:00
Mohamed Boudra
4001b7dc0a refactor: remove heuristic parsing, use pure type-based tool rendering
- 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>
2025-11-28 19:38:42 +00:00
Mohamed Boudra
38b08fec0c feat: add structured tool result types for better rendering
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>
2025-11-28 19:24:52 +00:00
Mohamed Boudra
7278a9515f fix(server): resolve agent cwd to absolute path at creation time
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>
2025-11-28 19:01:00 +00:00
Mohamed Boudra
eea28d59c9 fix(server): extract tool result content from SDK blocks
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>
2025-11-28 18:52:13 +00:00
Mohamed Boudra
e80989ea78 perf: remove raw field from timeline items to reduce payload size
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>
2025-11-28 18:20:33 +00:00
Mohamed Boudra
ae4678bca8 fix: eliminate duplicate WebSocket messages during agent history priming
- 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>
2025-11-28 17:44:07 +00:00
Mohamed Boudra
3dc517366d fix: record user messages for MCP-triggered agent prompts
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>
2025-11-28 12:48:21 +00:00
Mohamed Boudra
1b019c4688 chore: update android scripts and add dev runner with IPC restart support 2025-11-28 11:39:31 +01:00
Mohamed Boudra
2c84447ec2 fix(app): resolve create agent dictation confirm handler timing issue
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>
2025-11-28 10:10:31 +00:00
Mohamed Boudra
30d1b63b2b chore: typecheck and build readiness 2025-11-24 22:31:41 +01:00
Mohamed Boudra
47a99f5668 Fix reasoning timeline UI and type errors 2025-11-23 14:12:53 +01:00
Mohamed Boudra
95bacf8fc7 feat: add git branch/worktree setup, message queueing, file explorer improvements, and server restart 2025-11-22 23:20:42 +01:00
Mohamed Boudra
9feec81047 feat: improve audio streaming and add wait-for-agent cancellation support 2025-11-16 18:02:13 +01:00
Mohamed Boudra
b046dae799 refactor: rebrand project from voice-dev to paseo across all packages and configs 2025-11-15 20:45:09 +01:00
Mohamed Boudra
7bdafee818 Type Codex rollout parser 2025-11-15 20:24:53 +01:00
Mohamed Boudra
adda0d92d0 Fix repo typecheck failures 2025-11-15 20:17:47 +01:00
Mohamed Boudra
9dcc8314b2 Add barge-in telemetry 2025-11-15 19:31:27 +01:00
Mohamed Boudra
7284efd0fe Prototype streaming TTS chunks 2025-11-15 19:06:53 +01:00
Mohamed Boudra
104aae95da Stop emitting TTS after speech detection 2025-11-15 18:41:31 +01:00
Mohamed Boudra
377fa196f8 Abort realtime playback as soon as speech arrives 2025-11-15 18:26:37 +01:00
Mohamed Boudra
e7b8cc373c Add JSON validation to MCP tool responses 2025-11-15 18:18:14 +01:00
Mohamed Boudra
2a02f41182 refactor: implement agent cancellation and deletion with UI controls
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.
2025-11-15 18:13:04 +01:00
Mohamed Boudra
b45583a2b2 refactor: standardize pending permission keying and user message hydration 2025-11-15 17:36:15 +01:00
Mohamed Boudra
edcfdf970d refactor(ui): extract diff viewer and tool call parsers into reusable components 2025-11-15 16:28:57 +01:00
Mohamed Boudra
c37e499562 refactor(agent): unify timeline events with tool_call schema and add resume/refresh capabilities 2025-11-15 11:58:41 +01:00
Mohamed Boudra
8cf808b14d refactor(agent): consolidate agent system into unified AgentManager with provider-based architecture
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>
2025-11-15 02:06:09 +01:00
Mohamed Boudra
90b0094aae feat: add agent registry 2025-11-14 20:20:17 +01:00
Mohamed Boudra
5a2b84ee6f test(agent): enhance timeline event tracking for commands and file changes 2025-11-14 19:59:34 +01:00
Mohamed Boudra
0f3668c9ed test(agent): add permission request handling tests for Codex agent 2025-11-14 19:40:46 +01:00
Mohamed Boudra
1dfb7913b1 feat(agent): add AgentManager for lifecycle and session management 2025-11-14 19:25:37 +01:00
Mohamed Boudra
8a0a6d9488 refactor(agent): add session history persistence and permission timeouts for Claude agent 2025-11-14 19:14:23 +01:00
Mohamed Boudra
b2c89df7c7 refactor(file-explorer): add deep linking, path navigation, diff preview, and Codex session persistence 2025-11-14 19:02:54 +01:00
Mohamed Boudra
c5b30ed878 Add read-only file explorer 2025-11-07 20:36:23 +01:00
Mohamed Boudra
a118fd3315 refactor(agent): add wait_for_agent tool and simplify prompt sending API 2025-11-03 11:47:15 +01:00
Mohamed Boudra
1d22fe46e7 refactor: streamline agent orchestration and add blockquote styling
- 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>
2025-10-30 19:59:10 +01:00
Mohamed Boudra
54c19f89bf fix(git-diff): refresh diff data on screen mount and ignore agents.json
- Always request fresh git diff when screen opens (no caching)
- Add packages/server/agents.json to .gitignore (runtime data)
- Remove agents.json from git tracking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 22:36:24 +01:00
Mohamed Boudra
086dde30cc feat(agent): add git diff viewer and improve permission handling
- 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>
2025-10-26 22:19:16 +01:00
Mohamed Boudra
70a1852e57 refactor(modal): replace bottom sheet with native modal and custom animations
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>
2025-10-26 20:37:14 +01:00
Mohamed Boudra
edf47a24bc refactor(agent): consolidate agent type definitions and add multi-agent-type support 2025-10-26 18:03:03 +01:00
Mohamed Boudra
cf7e14e36b fix(keyboard): use transform instead of padding for keyboard animation 2025-10-26 16:19:30 +01:00
Mohamed Boudra
d47019919e refactor(ui): improve footer controls layout and add scroll-to-bottom button
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>
2025-10-26 15:03:33 +01:00
Mohamed Boudra
c4bb10d3c9 feat: add voice note recording overlay with transcription feedback and worktree support 2025-10-26 13:48:14 +01:00
Mohamed Boudra
dcfdccf07f fix(worktree): implement worktree creation for agent isolation
- 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>
2025-10-26 13:28:05 +01:00
Mohamed Boudra
4323d7d193 fix(session): emit agent_status on mode change for immediate UI update
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>
2025-10-26 10:18:51 +01:00
Mohamed Boudra
7fee9d4dc4 refactor(agent-manager): add error logging for agent prompt refusal 2025-10-26 09:52:43 +01:00