mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
- Update AgentDefinition type with agentType, source, isActive, modelDisplay fields - Refactor agentStore to support activeAgents/allAgents with cwd parameter - Add i18n strings for agent browser UI (source labels, summary, status) - Update server agents API with serialization helpers and override resolution - Update tests to match new agent data structure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
745 B
TypeScript
37 lines
745 B
TypeScript
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}`)
|
|
},
|
|
}
|