feat(agents): make OmO default agent via build name hack
- Set build agent's display name to 'OmO' (keeps builtIn: true priority) - Add OmO as subagent (actual execution target when selected) - Remove explicit tools list from OmO agent (inherit all) - Rename omo_agent.disable_build to omo_agent.disabled This hack works around OpenCode's agent selection by key name. TODO: Use config.default_agent when PR #5313 is released. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -366,41 +366,6 @@ export const omoAgent: AgentConfig = {
|
||||
budgetTokens: 32000,
|
||||
},
|
||||
maxTokens: 128000,
|
||||
tools: {
|
||||
read: true,
|
||||
write: true,
|
||||
edit: true,
|
||||
multiedit: true,
|
||||
patch: true,
|
||||
glob: true,
|
||||
grep: true,
|
||||
list: true,
|
||||
bash: true,
|
||||
batch: true,
|
||||
webfetch: true,
|
||||
websearch: true,
|
||||
codesearch: true,
|
||||
todowrite: true,
|
||||
todoread: true,
|
||||
task: true,
|
||||
lsp_hover: true,
|
||||
lsp_goto_definition: true,
|
||||
lsp_find_references: true,
|
||||
lsp_document_symbols: true,
|
||||
lsp_workspace_symbols: true,
|
||||
lsp_diagnostics: true,
|
||||
lsp_rename: true,
|
||||
lsp_prepare_rename: true,
|
||||
lsp_code_actions: true,
|
||||
lsp_code_action_resolve: true,
|
||||
lsp_servers: true,
|
||||
ast_grep_search: true,
|
||||
ast_grep_replace: true,
|
||||
skill: true,
|
||||
call_omo_agent: true,
|
||||
background_task: true,
|
||||
background_output: true,
|
||||
},
|
||||
prompt: OMO_SYSTEM_PROMPT,
|
||||
color: "#00CED1",
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export const ClaudeCodeConfigSchema = z.object({
|
||||
})
|
||||
|
||||
export const OmoAgentConfigSchema = z.object({
|
||||
disable_build: z.boolean().optional(),
|
||||
disabled: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const OhMyOpenCodeConfigSchema = z.object({
|
||||
|
||||
33
src/index.ts
33
src/index.ts
@@ -279,15 +279,32 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
const userAgents = (pluginConfig.claude_code?.agents ?? true) ? loadUserAgents() : {};
|
||||
const projectAgents = (pluginConfig.claude_code?.agents ?? true) ? loadProjectAgents() : {};
|
||||
|
||||
const shouldHideBuild = pluginConfig.omo_agent?.disable_build !== false;
|
||||
const isOmoEnabled = pluginConfig.omo_agent?.disabled !== true;
|
||||
|
||||
config.agent = {
|
||||
...builtinAgents,
|
||||
...userAgents,
|
||||
...projectAgents,
|
||||
...config.agent,
|
||||
...(shouldHideBuild ? { build: { mode: "subagent" } } : {}),
|
||||
};
|
||||
if (isOmoEnabled && builtinAgents.OmO) {
|
||||
// TODO: When OpenCode releases `default_agent` config option (PR #5313),
|
||||
// remove this hack and use `config.default_agent = "OmO"` instead.
|
||||
// This hack works by:
|
||||
// 1. Setting build agent's display name to "OmO" (builtIn: true, appears first in TUI)
|
||||
// 2. Adding OmO as a subagent (actual execution target when "OmO" is selected)
|
||||
// Tracking: https://github.com/sst/opencode/pull/5313
|
||||
const { OmO: omoConfig, ...restAgents } = builtinAgents;
|
||||
config.agent = {
|
||||
...restAgents,
|
||||
...userAgents,
|
||||
...projectAgents,
|
||||
...config.agent,
|
||||
build: { ...omoConfig, name: "OmO" },
|
||||
OmO: { ...omoConfig, mode: "subagent" },
|
||||
};
|
||||
} else {
|
||||
config.agent = {
|
||||
...builtinAgents,
|
||||
...userAgents,
|
||||
...projectAgents,
|
||||
...config.agent,
|
||||
};
|
||||
}
|
||||
|
||||
config.tools = {
|
||||
...config.tools,
|
||||
|
||||
Reference in New Issue
Block a user