agent_crew icon indicating copy to clipboard operation
agent_crew copied to clipboard

Refactor: Update TypeScript types and API client for sub-agent architecture

Open sre-helmcode opened this issue 9 months ago • 1 comments

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_message added 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

  • [ ] Agent type includes all four new sub-agent fields
  • [ ] CreateTeamRequest agent shape matches the new backend DTO
  • [ ] TypeScript compiles without errors (npm run build)
  • [ ] All existing unit tests pass
  • [ ] Test mocks in src/test/mocks.ts updated to include new fields

sre-helmcode avatar Feb 21 '26 14:02 sre-helmcode

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_mode añadidos a la interfaz Agent
  • CreateAgentInput, CreateAgentRequest, UpdateAgentRequest actualizados
  • mockWorkerAgent añadido en mocks.ts
  • TypeScript compila sin errores

sre-helmcode avatar Feb 21 '26 15:02 sre-helmcode