diff --git a/packages/app/src/hooks/use-aggregated-agents.ts b/packages/app/src/hooks/use-aggregated-agents.ts index 034bb282c..425ddb3c7 100644 --- a/packages/app/src/hooks/use-aggregated-agents.ts +++ b/packages/app/src/hooks/use-aggregated-agents.ts @@ -62,6 +62,10 @@ export function useAggregatedAgents(): AggregatedAgentsResult { const serverLabel = connectionStates.get(serverId)?.daemon.label ?? serverId; for (const agent of agents.values()) { // Use agent's own lastActivityAt field directly + // Skip child agents - only show root agents on homepage + if (agent.parentAgentId) { + continue; + } allAgents.push({ id: agent.id, serverId, @@ -74,6 +78,7 @@ export function useAggregatedAgents(): AggregatedAgentsResult { requiresAttention: agent.requiresAttention, attentionReason: agent.attentionReason, attentionTimestamp: agent.attentionTimestamp, + parentAgentId: agent.parentAgentId, }); } } diff --git a/plan.md b/plan.md index 0f3b51ee2..43b68a3c1 100644 --- a/plan.md +++ b/plan.md @@ -308,19 +308,21 @@ Files requiring modification: - Run typecheck after changes. - **Done (2025-12-21 21:15)**: Added `parentAgentId` optional field to `create_agent` tool input schema in `mcp-server.ts:223-228`. Updated handler to accept `parentAgentId` parameter and pass it to `agentManager.createAgent()` in `mcp-server.ts:275`. Also updated `registerSession()` in `agent-manager.ts:730` to copy `parentAgentId` from config to the managed agent. Typecheck passes. -- [ ] **Implement**: Add parentAgentId to client types and session store. +- [x] **Implement**: Add parentAgentId to client types and session store. - Add `parentAgentId?: string` to `Agent` interface in `session-store.ts:85` - Add `parentAgentId?: string` to `AgentDirectoryEntry` in `agent-directory.ts:4` - Update message schema if needed in `messages.ts:351` - Run typecheck after changes. + - **Done (2025-12-21 21:30)**: Added `parentAgentId?: string` to `Agent` interface in `session-store.ts:109`, `AgentDirectoryEntry` in `agent-directory.ts:15`, and updated `getAgentDirectory()` in `session-store.ts:835` to include it. Also updated `normalizeAgentSnapshot()` in `session-context.tsx:142` to map from server payload. Server's `AgentSnapshotPayloadSchema` already had `parentAgentId`. Typecheck passes. -- [ ] **Implement**: Filter homepage to show only root agents. +- [x] **Implement**: Filter homepage to show only root agents. - In `use-aggregated-agents.ts`, filter agents: `agents.filter(a => !a.parentAgentId)` - Or filter in `agent-list.tsx` before rendering - Root agents are those with `parentAgentId === undefined` or `null` - Run typecheck after changes. + - **Done (2025-12-21 21:45)**: Added filter in `use-aggregated-agents.ts:66-68` to skip agents with `parentAgentId` when building the aggregated agents list. Also included `parentAgentId` in the aggregated agent object. Typecheck passes. - [ ] **Implement**: Add sub-agents section to agent info menu.