2025-12-05 02:32:33 +09:00
|
|
|
import type { AgentConfig } from "@opencode-ai/sdk"
|
2025-12-13 22:13:23 +09:00
|
|
|
import type { BuiltinAgentName, AgentOverrideConfig, AgentOverrides } from "./types"
|
2025-12-14 17:16:32 +09:00
|
|
|
import { omoAgent } from "./omo"
|
2025-12-05 02:32:33 +09:00
|
|
|
import { oracleAgent } from "./oracle"
|
|
|
|
|
import { librarianAgent } from "./librarian"
|
|
|
|
|
import { exploreAgent } from "./explore"
|
|
|
|
|
import { frontendUiUxEngineerAgent } from "./frontend-ui-ux-engineer"
|
|
|
|
|
import { documentWriterAgent } from "./document-writer"
|
2025-12-13 15:25:29 +09:00
|
|
|
import { multimodalLookerAgent } from "./multimodal-looker"
|
2025-12-13 12:00:38 +09:00
|
|
|
import { deepMerge } from "../shared"
|
2025-12-05 02:32:33 +09:00
|
|
|
|
2025-12-13 22:13:23 +09:00
|
|
|
const allBuiltinAgents: Record<BuiltinAgentName, AgentConfig> = {
|
2025-12-14 17:16:32 +09:00
|
|
|
OmO: omoAgent,
|
2025-12-05 02:32:33 +09:00
|
|
|
oracle: oracleAgent,
|
|
|
|
|
librarian: librarianAgent,
|
|
|
|
|
explore: exploreAgent,
|
|
|
|
|
"frontend-ui-ux-engineer": frontendUiUxEngineerAgent,
|
|
|
|
|
"document-writer": documentWriterAgent,
|
2025-12-13 15:25:29 +09:00
|
|
|
"multimodal-looker": multimodalLookerAgent,
|
2025-12-05 02:32:33 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mergeAgentConfig(
|
|
|
|
|
base: AgentConfig,
|
|
|
|
|
override: AgentOverrideConfig
|
|
|
|
|
): AgentConfig {
|
2025-12-13 12:00:38 +09:00
|
|
|
return deepMerge(base, override as Partial<AgentConfig>)
|
2025-12-05 02:32:33 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createBuiltinAgents(
|
2025-12-13 22:13:23 +09:00
|
|
|
disabledAgents: BuiltinAgentName[] = [],
|
2025-12-05 02:32:33 +09:00
|
|
|
agentOverrides: AgentOverrides = {}
|
|
|
|
|
): Record<string, AgentConfig> {
|
|
|
|
|
const result: Record<string, AgentConfig> = {}
|
|
|
|
|
|
|
|
|
|
for (const [name, config] of Object.entries(allBuiltinAgents)) {
|
2025-12-13 22:13:23 +09:00
|
|
|
const agentName = name as BuiltinAgentName
|
2025-12-05 02:32:33 +09:00
|
|
|
|
|
|
|
|
if (disabledAgents.includes(agentName)) {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const override = agentOverrides[agentName]
|
|
|
|
|
if (override) {
|
|
|
|
|
result[name] = mergeAgentConfig(config, override)
|
|
|
|
|
} else {
|
|
|
|
|
result[name] = config
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
}
|