b24b00fad2
- Add BUILD_AGENT_PROMPT_EXTENSION for orchestrator-focused main agent behavior - Introduce OverridableAgentName type to allow build agent customization - Update config schema to support build agent override in oh-my-opencode.json - Inject orchestration prompt into build agent's system prompt 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import type { AgentConfig } from "@opencode-ai/sdk"
|
|
import type { BuiltinAgentName, AgentOverrideConfig, AgentOverrides } from "./types"
|
|
import { oracleAgent } from "./oracle"
|
|
import { librarianAgent } from "./librarian"
|
|
import { exploreAgent } from "./explore"
|
|
import { frontendUiUxEngineerAgent } from "./frontend-ui-ux-engineer"
|
|
import { documentWriterAgent } from "./document-writer"
|
|
import { multimodalLookerAgent } from "./multimodal-looker"
|
|
import { deepMerge } from "../shared"
|
|
|
|
const allBuiltinAgents: Record<BuiltinAgentName, AgentConfig> = {
|
|
oracle: oracleAgent,
|
|
librarian: librarianAgent,
|
|
explore: exploreAgent,
|
|
"frontend-ui-ux-engineer": frontendUiUxEngineerAgent,
|
|
"document-writer": documentWriterAgent,
|
|
"multimodal-looker": multimodalLookerAgent,
|
|
}
|
|
|
|
function mergeAgentConfig(
|
|
base: AgentConfig,
|
|
override: AgentOverrideConfig
|
|
): AgentConfig {
|
|
return deepMerge(base, override as Partial<AgentConfig>)
|
|
}
|
|
|
|
export function createBuiltinAgents(
|
|
disabledAgents: BuiltinAgentName[] = [],
|
|
agentOverrides: AgentOverrides = {}
|
|
): Record<string, AgentConfig> {
|
|
const result: Record<string, AgentConfig> = {}
|
|
|
|
for (const [name, config] of Object.entries(allBuiltinAgents)) {
|
|
const agentName = name as BuiltinAgentName
|
|
|
|
if (disabledAgents.includes(agentName)) {
|
|
continue
|
|
}
|
|
|
|
const override = agentOverrides[agentName]
|
|
if (override) {
|
|
result[name] = mergeAgentConfig(config, override)
|
|
} else {
|
|
result[name] = config
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|