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>
This commit is contained in:
Mohamed Boudra
2025-12-21 17:15:29 +00:00
parent 978a544f19
commit a574429a7b
5 changed files with 6 additions and 1 deletions

View File

@@ -94,6 +94,7 @@ type ManagedAgentBase = {
lastUsage?: AgentUsage;
lastError?: string;
attention: AttentionState;
parentAgentId?: string;
};
type ManagedAgentWithSession = ManagedAgentBase & {

View File

@@ -80,6 +80,7 @@ export function toAgentPayload(
pendingPermissions: sanitizePendingPermissions(agent.pendingPermissions),
persistence: sanitizePersistenceHandle(agent.persistence),
title: options?.title ?? null,
parentAgentId: agent.parentAgentId,
};
const usage = sanitizeOptionalJsonValue<AgentUsage>(agent.lastUsage);

View File

@@ -161,6 +161,7 @@ export type AgentSessionConfig = {
claude?: Partial<ClaudeAgentOptions>;
};
mcpServers?: Record<string, unknown>;
parentAgentId?: string;
};
export interface AgentSession {

View File

@@ -245,6 +245,7 @@ export const AgentSnapshotPayloadSchema = z.object({
requiresAttention: z.boolean().optional(),
attentionReason: z.enum(["finished", "error", "permission"]).nullable().optional(),
attentionTimestamp: z.string().nullable().optional(),
parentAgentId: z.string().optional(),
});
export type AgentSnapshotPayload = z.infer<typeof AgentSnapshotPayloadSchema>;

View File

@@ -292,12 +292,13 @@ Files requiring modification:
---
- [ ] **Implement**: Add parentAgentId field to server types.
- [x] **Implement**: Add parentAgentId field to server types.
- Add `parentAgentId?: string` to `ManagedAgentBase` in `agent-manager.ts:77`
- Add `parentAgentId?: string` to `AgentSessionConfig` in `agent-sdk-types.ts:148`
- Update `toAgentPayload()` in `agent-projections.ts` to include `parentAgentId`
- Run typecheck after changes.
- **Done (2025-12-21 19:45)**: Added `parentAgentId?: string` to `ManagedAgentBase` in `agent-manager.ts:97`, `AgentSessionConfig` in `agent-sdk-types.ts:164`, and `AgentSnapshotPayloadSchema` in `messages.ts:248`. Updated `toAgentPayload()` in `agent-projections.ts:83` to include `parentAgentId` in the payload. Typecheck passes.
- [ ] **Implement**: Add parentAgentId to MCP create_agent tool.