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
co-authored by Claude Opus 4.5
parent 978a544f19
commit a574429a7b
5 changed files with 6 additions and 1 deletions
@@ -94,6 +94,7 @@ type ManagedAgentBase = {
lastUsage?: AgentUsage; lastUsage?: AgentUsage;
lastError?: string; lastError?: string;
attention: AttentionState; attention: AttentionState;
parentAgentId?: string;
}; };
type ManagedAgentWithSession = ManagedAgentBase & { type ManagedAgentWithSession = ManagedAgentBase & {
@@ -80,6 +80,7 @@ export function toAgentPayload(
pendingPermissions: sanitizePendingPermissions(agent.pendingPermissions), pendingPermissions: sanitizePendingPermissions(agent.pendingPermissions),
persistence: sanitizePersistenceHandle(agent.persistence), persistence: sanitizePersistenceHandle(agent.persistence),
title: options?.title ?? null, title: options?.title ?? null,
parentAgentId: agent.parentAgentId,
}; };
const usage = sanitizeOptionalJsonValue<AgentUsage>(agent.lastUsage); const usage = sanitizeOptionalJsonValue<AgentUsage>(agent.lastUsage);
@@ -161,6 +161,7 @@ export type AgentSessionConfig = {
claude?: Partial<ClaudeAgentOptions>; claude?: Partial<ClaudeAgentOptions>;
}; };
mcpServers?: Record<string, unknown>; mcpServers?: Record<string, unknown>;
parentAgentId?: string;
}; };
export interface AgentSession { export interface AgentSession {
+1
View File
@@ -245,6 +245,7 @@ export const AgentSnapshotPayloadSchema = z.object({
requiresAttention: z.boolean().optional(), requiresAttention: z.boolean().optional(),
attentionReason: z.enum(["finished", "error", "permission"]).nullable().optional(), attentionReason: z.enum(["finished", "error", "permission"]).nullable().optional(),
attentionTimestamp: z.string().nullable().optional(), attentionTimestamp: z.string().nullable().optional(),
parentAgentId: z.string().optional(),
}); });
export type AgentSnapshotPayload = z.infer<typeof AgentSnapshotPayloadSchema>; export type AgentSnapshotPayload = z.infer<typeof AgentSnapshotPayloadSchema>;
+2 -1
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 `ManagedAgentBase` in `agent-manager.ts:77`
- Add `parentAgentId?: string` to `AgentSessionConfig` in `agent-sdk-types.ts:148` - Add `parentAgentId?: string` to `AgentSessionConfig` in `agent-sdk-types.ts:148`
- Update `toAgentPayload()` in `agent-projections.ts` to include `parentAgentId` - Update `toAgentPayload()` in `agent-projections.ts` to include `parentAgentId`
- Run typecheck after changes. - 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. - [ ] **Implement**: Add parentAgentId to MCP create_agent tool.