codev / desktop /src /api /agents.ts
chenbhao's picture
feat: desktop
1f21206
Raw
History Blame
745 Bytes
import { api } from './client'
export type AgentSource =
| 'built-in'
| 'plugin'
| 'userSettings'
| 'projectSettings'
| 'localSettings'
| 'flagSettings'
| 'policySettings'
export type AgentDefinition = {
agentType: string
description?: string
model?: string
modelDisplay?: string
tools?: string[]
systemPrompt?: string
color?: string
source: AgentSource
baseDir?: string
overriddenBy?: AgentSource
isActive: boolean
}
export type AgentListResponse = {
activeAgents: AgentDefinition[]
allAgents: AgentDefinition[]
}
export const agentsApi = {
list: (cwd?: string) => {
const query = cwd ? `?cwd=${encodeURIComponent(cwd)}` : ''
return api.get<AgentListResponse>(`/api/agents${query}`)
},
}