agent_crew
agent_crew copied to clipboard
Refactor: Update TypeScript types and API client for sub-agent architecture
Context
The backend Agent model is being extended with sub-agent configuration fields as part of the architectural refactor. The frontend types and API client must be updated to reflect this.
Depends on: agent_crew_api — Extend Agent model with sub-agent configuration fields
Changes Required
src/types/index.ts
Add to the Agent interface:
sub_agent_description?: string // delegation trigger — "when should leader delegate here?"
sub_agent_tools?: string // comma-separated tools, e.g. "Read, Grep, Bash"
sub_agent_model?: string // "inherit" | "sonnet" | "opus" | "haiku"
sub_agent_permission_mode?: string // "default" | "acceptEdits" | "dontAsk" | "bypassPermissions"
- Repurpose
claude_md: for leader = CLAUDE.md content; for non-leader = sub-agent system prompt body - Remove any inter-agent WebSocket event types that are no longer relevant (e.g.
agent_messageadded in #1)
src/services/api.ts
Update the agent creation shape inside CreateTeamRequest:
agents: Array<{
name: string
role: 'leader' | 'worker'
claude_md?: string
sub_agent_description?: string
sub_agent_tools?: string
sub_agent_model?: string
sub_agent_permission_mode?: string
}>
- Remove any relay-specific API calls if present
src/services/websocket.ts
- Remove handling of inter-agent event types (
agent_message, etc.) if present
Acceptance Criteria
- [ ]
Agenttype includes all four new sub-agent fields - [ ]
CreateTeamRequestagent shape matches the new backend DTO - [ ] TypeScript compiles without errors (
npm run build) - [ ] All existing unit tests pass
- [ ] Test mocks in
src/test/mocks.tsupdated to include new fields
Estado al pausar sesión
COMPLETADO — implementado y verificado (195 tests pasando).
Lo que se hizo
- Campos
sub_agent_description,sub_agent_tools,sub_agent_model,sub_agent_permission_modeañadidos a la interfazAgent CreateAgentInput,CreateAgentRequest,UpdateAgentRequestactualizadosmockWorkerAgentañadido en mocks.ts- TypeScript compila sin errores