/ components / agents / types.ts
types.ts
 1  import type { SettingSource } from 'src/utils/settings/constants.js'
 2  import type { AgentDefinition } from '../../tools/AgentTool/loadAgentsDir.js'
 3  
 4  export const AGENT_PATHS = {
 5    FOLDER_NAME: '.claude',
 6    AGENTS_DIR: 'agents',
 7  } as const
 8  
 9  // Base types for common patterns
10  type WithPreviousMode = { previousMode: ModeState }
11  type WithAgent = { agent: AgentDefinition }
12  
13  // Simplified state type using intersection types
14  export type ModeState =
15    | { mode: 'main-menu' }
16    | { mode: 'list-agents'; source: SettingSource | 'all' | 'built-in' }
17    | ({ mode: 'agent-menu' } & WithAgent & WithPreviousMode)
18    | ({ mode: 'view-agent' } & WithAgent & WithPreviousMode)
19    | { mode: 'create-agent' }
20    | ({ mode: 'edit-agent' } & WithAgent & WithPreviousMode)
21    | ({ mode: 'delete-confirm' } & WithAgent & WithPreviousMode)
22  
23  export type AgentValidationResult = {
24    isValid: boolean
25    warnings: string[]
26    errors: string[]
27  }