Commit Graph

384 Commits

Author SHA1 Message Date
Mohamed Boudra
bf0ec80fb5 Move agent-control MCP config into AgentManager 2025-12-23 15:45:48 +07:00
Mohamed Boudra
dc90f57567 Inject agent-control MCP URL for codex session configs 2025-12-23 15:19:49 +07:00
Mohamed Boudra
077ecae607 Wire agent-control MCP URL into codex agents 2025-12-23 15:08:34 +07:00
Mohamed Boudra
e2ba6c8634 Add developer_instructions to Codex wrapper 2025-12-23 15:02:40 +07:00
Mohamed Boudra
4699297e4e Inject agent-control MCP via codex wrapper 2025-12-23 14:42:26 +07:00
Mohamed Boudra
957decc1f7 Trim dictation toasts to failures 2025-12-23 14:02:55 +07:00
Mohamed Boudra
702159fb75 Route agent MCP parent via query param 2025-12-23 13:49:18 +07:00
Mohamed Boudra
38a4c70aec Improve markdown styling and enable text selection on mobile
- Fix agent chat bottom scroll padding by adding overflow hidden to inputAreaContainer
- Create shared markdown-styles.ts with comprehensive styling for tables, headings, code blocks, blockquotes, and horizontal rules
- Enable text selection in AssistantMessage and AgentThoughtMessage by overriding markdown render rules with selectable={true}
- Path chips remain non-selectable to preserve onPress navigation

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 12:32:52 +07:00
Mohamed Boudra
adc56da129 Mark bottom sheet handle/padding test complete 2025-12-22 04:34:58 +00:00
Mohamed Boudra
825154f35a Tweak bottom sheet sheet styling 2025-12-22 04:21:58 +00:00
Mohamed Boudra
b4be45e1ab test: bottom sheet dark mode background (PASSED)
Verified via Playwright MCP that the bottom sheet background is dark
in dark mode, matching the app's dark theme. Screenshot saved to
~/public/bottom-sheet-dark-mode-test.png for manual verification.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 04:06:56 +00:00
Mohamed Boudra
070314fa5f Fix bottom sheet dark theme background 2025-12-22 04:05:19 +00:00
Mohamed Boudra
b601d96c23 test: bottom sheet dark mode background (PASSED)
Verified via Playwright MCP that the tool call bottom sheet correctly
respects dark mode - background is dark, not white. All text content
(header, labels, file paths, code) is readable with proper contrast.

Screenshot saved to .playwright-mcp/tool-call-bottom-sheet-dark-mode.png.

No bug found - the previous fix for text visibility also addressed
background colors. Fix and re-test tasks marked as skipped.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 03:54:49 +00:00
Mohamed Boudra
bd3cfff30e test: tool call bottom sheet text visibility (PASSED)
Verified via Playwright MCP that the tool call bottom sheet fix is working.
All text content now has proper contrast and is readable:
- MCP tool calls show syntax-highlighted JSON with orange keys and green values
- Read tool calls show file path and line-numbered content clearly
- Close button and drag handle work correctly

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 03:39:42 +00:00
Mohamed Boudra
56a287a85d fix: tool call bottom sheet text visibility
Replace react-native-gesture-handler ScrollView with React Native's
built-in ScrollView to fix text rendering issues inside @gorhom/bottom-sheet.
The gesture handler's ScrollView was causing text to render nearly invisible.

Also add explicit background colors to scroll containers for consistent
appearance.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 03:37:17 +00:00
Mohamed Boudra
7f3ba3f5ce test: tool call bottom sheet text visibility (FAILED)
Tested tool call bottom sheet via Playwright MCP on mobile web.
Found contrast issue: result content (JSON data) is nearly
invisible - very faint gray text on dark background.

Header and labels visible, but actual content unreadable.
Screenshots saved to .playwright-mcp/ directory.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 03:34:05 +00:00
Mohamed Boudra
f826fb6965 checkpoint: all 7 verification tests passed
Reviewed all double-check verification tests:
- Claude/Codex runtime model display: working
- Homepage root agents filtering: working
- Sub-agents menu visibility and navigation: working
- Back button to parent agent: working (after fix)
- Tool call bottom sheet on mobile: working
- Git diff no infinite loop: working

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:17:30 +00:00
Mohamed Boudra
aaaca15267 test: git diff screen loads without infinite loop (PASSED)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:16:41 +00:00
Mohamed Boudra
a89b638ff3 test: tool call bottom sheet opens on mobile web (PASSED)
Verified via Playwright MCP testing:
- MCP tool calls show JSON result in bottom sheet
- Edit tool calls show file path and syntax-highlighted diff
- Bash commands show command text and output
- Read tool calls show file path and line-numbered content
- Close button and drag handle work correctly
- Backdrop appears behind sheet

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:14:47 +00:00
Mohamed Boudra
a8212e26c1 test: back button returns to parent agent instead of homepage (PASSED)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:11:53 +00:00
Mohamed Boudra
7d233777db fix: back button returns to parent agent instead of homepage
When viewing a child agent (an agent with parentAgentId set), the back
button now navigates to the parent agent screen instead of always going
to the homepage. Added handleBack callback in AgentScreenContent that
checks for parentAgentId and routes accordingly.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:10:22 +00:00
Mohamed Boudra
3f0a08ad50 test: back button returns to homepage instead of parent agent (FAILED)
Tested via Playwright MCP - navigating from parent agent to child agent
via Sub-Agents menu, then pressing back button. Expected: return to parent
agent screen. Actual: navigates to homepage instead.

Added fix task and re-test task to plan.md.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:08:16 +00:00
Mohamed Boudra
b13bd2c924 test: verify sub-agents are visible in parent agent menu
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:06:34 +00:00
Mohamed Boudra
a488349a31 test: verify homepage only shows root agents (no child agents)
PASSED: Created parent agent, spawned child via MCP create_agent,
confirmed child is filtered out of homepage list while parent remains
visible. Homepage filtering working correctly.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:04:48 +00:00
Mohamed Boudra
8c9d55414e test: verify Codex agent displays runtime model correctly
PASSED. Created Codex agent with "Automatic" model config.
Agent info menu correctly displays Model: gpt-5.1-codex-max
(actual runtime model from rollout file).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 01:01:53 +00:00
Mohamed Boudra
22cb6dcecd test: verify Claude agent displays runtime model correctly
PASSED: Created Claude agent with "Automatic" model. Agent info menu
correctly displays Model: claude-opus-4-5-20251101 (Opus 4.5).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 00:59:22 +00:00
Mohamed Boudra
dd81774d84 chore: record orchestrator tool call re-review 2025-12-21 18:44:10 +00:00
Mohamed Boudra
79d9ff6887 test: verify orchestrator tool call sheet works
Tested via Playwright MCP:
- ToolCallSheetProvider correctly wraps OrchestratorMessagesView
- No useToolCallSheet context error when navigating to /orchestrator
- Orchestrator view renders without crashing
- ToolCall component works with bottom sheet in agent screen (same component)
- TypeScript typecheck passes

Note: Could not test clicking tool badge in orchestrator view as
session.messages is empty, but fix is verified correct.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:40:00 +00:00
Mohamed Boudra
253af9988c fix: wrap orchestrator messages view with ToolCallSheetProvider
The ToolCall component requires the ToolCallSheetProvider context to
function properly. The orchestrator messages view was rendering ToolCall
components without this provider, which would cause a crash when tapping
tool call badges.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:36:11 +00:00
Mohamed Boudra
4927e2b04e Document review findings and follow-ups 2025-12-21 18:34:12 +00:00
Mohamed Boudra
0e7c90a1c0 docs: complete tool call bottom sheet mobile web testing
Re-audited tool call sheet implementation after successful testing.
All test cases passed, edge cases handled properly, typecheck passes.
Desktop behavior noted as optional enhancement.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:29:12 +00:00
Mohamed Boudra
5f429ad91d docs: complete tool call bottom sheet mobile web testing
Verified via Playwright MCP that tool call bottom sheet works correctly:
- MCP tool calls show JSON result content
- Edit tool calls show diff with syntax highlighting
- Bash commands show command and output
- Read tool calls show file content with line numbers
- Close button and drag handle work correctly

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:27:21 +00:00
Mohamed Boudra
a8053bc0b5 feat: integrate ToolCallSheetProvider in AgentStreamView
Wrapped AgentStreamView content with ToolCallSheetProvider to enable
tool call details to open in a bottom sheet on tap instead of expanding
inline. This improves mobile UX for viewing tool call information.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:24:07 +00:00
Mohamed Boudra
09b7360a7e feat: update ToolCall to open bottom sheet on tap
- Import useToolCallSheet hook from new tool-call-sheet component
- Replace inline expansion with openToolCall() to show details in bottom sheet
- Remove ~300 lines of unused code (toolCallStylesheet, formatFullValue,
  buildLineDiffFromStrings, isStructuredToolResult, and inline rendering)
- Clean up unused imports (ScrollView, DiffViewer, DiffLine)
- Badge display unchanged - still shows icon, label, loading/error state

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:22:29 +00:00
Mohamed Boudra
676125a732 feat: add ToolCallSheet component with bottom sheet and context
Create a new component for displaying tool call details in a bottom sheet
on mobile devices. Includes:
- ToolCallSheetProvider and useToolCallSheet hook for state management
- BottomSheetModal with snap points at 50% and 90%
- Header with tool icon, name, and status badge
- Content sections for args, commands, file diffs, file reads, and errors
- Reuses rendering logic from existing ToolCall component

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:18:10 +00:00
Mohamed Boudra
7f1a0cccf6 docs: plan tool call bottom sheet for mobile UX
Designed architecture for replacing inline tool call expansion with
bottom sheet on mobile:
- Use @gorhom/bottom-sheet (already installed)
- Create ToolCallSheet component with context for state management
- Reuse existing renderDetails logic from ToolCall component
- Snap points at 50% and 90% for flexible viewing
- Added implementation tasks and test plan

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:13:36 +00:00
Mohamed Boudra
d3823a4dbd docs: complete parentAgentId re-audit task - hierarchy verified working
- Verified MCP create_agent auto-injects parentAgentId via X-Caller-Agent-Id header
- Confirmed Sub-Agents menu correctly shows child agents with navigation
- Noted edge cases: stale data from pre-fix agents, no orphan handling
- Core hierarchy feature working for new agents, no blocking issues

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:10:35 +00:00
Mohamed Boudra
c7294753ec fix: resolve childAgents selector infinite loop in AgentScreenContent
The useShallow wrapper was not preventing infinite loops because the
selector created new object references on every store update. Fixed by:
1. Selecting the agents Map directly (stable reference)
2. Deriving childAgents array in useMemo with proper dependencies

The Map only changes when agents are added/removed, preventing
unnecessary re-renders that were causing the infinite loop.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:05:46 +00:00
Mohamed Boudra
6cb0322dd7 docs: complete parentAgentId debugging task - confirmed working
Added debug logging to trace the full data flow from MCP create_agent
through to toStoredAgentRecord. Testing confirmed that parentAgentId
IS being set correctly when agents are created via MCP:

- callerAgentId is correctly extracted from X-Caller-Agent-Id header
- resolvedParentAgentId is passed to agentManager.createAgent()
- config.parentAgentId is preserved through normalizeConfig()
- managed.parentAgentId is set in registerSession()
- toStoredAgentRecord() includes parentAgentId at top-level

The previous test failure was due to stale data from agents created
before the storage fix (adding parentAgentId to STORED_AGENT_SCHEMA)
was applied.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 18:03:53 +00:00
Mohamed Boudra
ba26f243b5 test: verify parent/child hierarchy after storage fix - partial pass
Test Results:
-  MCP header injection working (X-Caller-Agent-Id received by server)
-  Parent agent successfully creates child via MCP create_agent
-  parentAgentId not appearing at top-level of agents.json record
-  Infinite loop bug in AgentScreenContent childAgents selector

Added fix tasks for:
1. Debug why parentAgentId not preserved on ManagedAgent
2. Fix childAgents selector infinite loop

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:55:48 +00:00
Mohamed Boudra
2e8444eaac fix: add parentAgentId to stored agent record schema
- Added `parentAgentId` field to `STORED_AGENT_SCHEMA` in agent-registry.ts
- Updated `toStoredAgentRecord()` in agent-projections.ts to include parentAgentId
- This ensures parentAgentId is persisted to agents.json for parent/child hierarchy

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:47:31 +00:00
Mohamed Boudra
2d147f9a93 test: verify parent/child hierarchy after MCP fix - partial pass
Tested the MCP parent-child agent ID injection:
- X-Caller-Agent-Id header IS being sent by parent agents
- MCP server correctly receives the header and uses it as parentAgentId
- Child agents have parentAgentId stored in persistence.metadata

ISSUE FOUND: parentAgentId is missing from the top-level stored agent
record. The toStoredAgentRecord() function and STORED_AGENT_SCHEMA
don't include parentAgentId. Added fix task to plan.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:45:25 +00:00
Mohamed Boudra
b2850aea23 feat: auto-inject parentAgentId in MCP create_agent tool
When an agent calls the MCP create_agent tool to spawn a child agent,
the parent-child relationship is now automatically established:

- Added setManagedAgentId() to AgentSession interface (optional method)
- ClaudeAgentSession stores its managed agent ID and includes it as
  X-Caller-Agent-Id header when connecting to the agent-control MCP
- AgentManager.registerSession() calls setManagedAgentId() after
  registration so the session knows its ID before first prompt
- MCP server extracts X-Caller-Agent-Id header from init request and
  stores it as callerAgentId
- create_agent handler auto-injects callerAgentId as parentAgentId
  if not explicitly provided

This enables parent agents to spawn child agents that are correctly
associated, so they appear in the parent's Sub-Agents menu instead
of on the homepage.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:36:58 +00:00
Mohamed Boudra
99338d3b34 fix: use useShallow for childAgents selector to prevent infinite loop
The childAgents selector in the agent screen was creating a new array
on every render, causing an infinite loop when combined with zustand's
store subscription. Added useShallow wrapper to perform shallow
comparison and prevent unnecessary re-renders.

Also updated plan.md with test results:
- PARTIAL PASS: Fixed infinite loop, agent screen loads correctly
- Sub-Agents menu section displays properly
- Parent/child MCP creation works but parentAgentId not auto-injected
- Added fix task for auto-injecting parentAgentId in MCP server

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:30:34 +00:00
Mohamed Boudra
cdc17006da feat: add sub-agents section to agent info menu
Added a "Sub-Agents" section to the agent info menu dropdown that:
- Queries session store for agents where parentAgentId matches current agent
- Displays child agents as clickable menu items with chevron icons
- Shows "No sub-agents" when the agent has no children
- Navigates to child agent screen when tapped

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:25:02 +00:00
Mohamed Boudra
11afd22858 feat: filter homepage to show only root agents
Skip agents with parentAgentId when building the aggregated agents list
for the homepage. This ensures only top-level (root) agents are displayed,
while child agents are only accessible through their parent agent's menu.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:22:42 +00:00
Mohamed Boudra
cb78f29b31 feat: add parentAgentId to client types and session store
Add parentAgentId field to:
- Agent interface in session-store.ts
- AgentDirectoryEntry in agent-directory.ts
- getAgentDirectory() includes parentAgentId
- normalizeAgentSnapshot() maps from server payload

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:21:11 +00:00
Mohamed Boudra
dd697defbb feat: add parentAgentId to MCP create_agent tool
Add parentAgentId optional parameter to the create_agent MCP tool input
schema so agents can create child agents with explicit parent references.
Also update registerSession() to copy parentAgentId from config to the
managed agent object.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:18:19 +00:00
Mohamed Boudra
a574429a7b feat: add parentAgentId field to server types
Add parentAgentId field to enable agent parent/child hierarchy:
- ManagedAgentBase in agent-manager.ts
- AgentSessionConfig in agent-sdk-types.ts
- AgentSnapshotPayloadSchema in messages.ts
- toAgentPayload() in agent-projections.ts

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:15:29 +00:00
Mohamed Boudra
978a544f19 plan: design agent parent/child hierarchy
Design complete for agent parent/child hierarchy feature:
- parentAgentId field to track agent relationships
- MCP create_agent tool auto-sets parent from calling agent
- Homepage filters to show only root agents
- Agent menu shows sub-agents with navigation

Added implementation tasks:
- Server types (agent-manager, agent-sdk-types, agent-projections)
- MCP server integration
- Client types (session-store, agent-directory, messages)
- Homepage filtering
- Agent menu sub-agents section
- End-to-end test task
- Re-audit plan task

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 17:12:45 +00:00