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
Description
Languages
TypeScript 98.1%
JavaScript 1.3%
Shell 0.1%
Swift 0.1%