From f44555a021ac40666f3b82a8cb28bb616fdb217d Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 14 Dec 2025 21:59:17 +0900 Subject: [PATCH] feat(agents): make OmO default agent via build name hack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) --- README.ko.md | 8 +++++--- README.md | 8 +++++--- src/agents/omo.ts | 35 ----------------------------------- src/config/schema.ts | 2 +- src/index.ts | 33 +++++++++++++++++++++++++-------- 5 files changed, 36 insertions(+), 50 deletions(-) diff --git a/README.ko.md b/README.ko.md index b652182..db86b9f 100644 --- a/README.ko.md +++ b/README.ko.md @@ -561,19 +561,21 @@ Google Gemini ๋ชจ๋ธ์„ ์œ„ํ•œ ๋‚ด์žฅ Antigravity OAuth๋ฅผ ํ™œ์„ฑํ™”ํ•ฉ๋‹ˆ๋‹ค: ### OmO Agent -๊ธฐ๋ณธ OmO ์—์ด์ „ํŠธ ๋™์ž‘์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค: +OmO๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ํ™œ์„ฑํ™”๋˜๋ฉฐ, ๊ธฐ๋ณธ primary ์—์ด์ „ํŠธ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ๋‚ด์žฅ "build" ์—์ด์ „ํŠธ๋ฅผ ๋Œ€์ฒดํ•˜๋ฉด์„œ `builtIn` ํ”Œ๋ž˜๊ทธ๋ฅผ ์œ ์ง€ํ•˜์—ฌ, OmO๊ฐ€ ์—์ด์ „ํŠธ ๋ชฉ๋ก์—์„œ ์ฒซ ๋ฒˆ์งธ๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. + +OmO๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•˜๊ณ  ์›๋ž˜ build ์—์ด์ „ํŠธ๋ฅผ ๋ณต์›ํ•˜๋ ค๋ฉด: ```json { "omo_agent": { - "disable_build": true + "disabled": true } } ``` | ์˜ต์…˜ | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | |------|--------|------| -| `disable_build` | `true` | `true`๋ฉด ๊ธฐ๋ณธ Build ์—์ด์ „ํŠธ๋ฅผ ์ˆจ๊น๋‹ˆ๋‹ค. OmO๊ฐ€ ์œ ์ผํ•œ primary ์—์ด์ „ํŠธ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. `false`๋กœ ์„ค์ •ํ•˜๋ฉด Build ์—์ด์ „ํŠธ๊ฐ€ OmO์™€ ํ•จ๊ป˜ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. | +| `disabled` | `false` | `true`๋ฉด OmO๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•˜๊ณ  ์›๋ž˜ build ์—์ด์ „ํŠธ๋ฅผ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค. `false`(๊ธฐ๋ณธ๊ฐ’)๋ฉด OmO๊ฐ€ build ์—์ด์ „ํŠธ๋ฅผ ๋Œ€์ฒดํ•˜์—ฌ ๊ธฐ๋ณธ primary ์—์ด์ „ํŠธ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. | ### Hooks diff --git a/README.md b/README.md index bd8cabf..959b1d7 100644 --- a/README.md +++ b/README.md @@ -562,19 +562,21 @@ Available agents: `oracle`, `librarian`, `explore`, `frontend-ui-ux-engineer`, ` ### OmO Agent -Configure the default OmO agent behavior: +OmO is enabled by default and becomes the default primary agent. It replaces the built-in "build" agent while keeping the `builtIn` flag, ensuring OmO appears first in the agent list. + +To disable OmO and restore the original build agent: ```json { "omo_agent": { - "disable_build": true + "disabled": true } } ``` | Option | Default | Description | |--------|---------|-------------| -| `disable_build` | `true` | When `true`, hides the default Build agent. OmO becomes the only primary agent. Set to `false` to show Build agent alongside OmO. | +| `disabled` | `false` | When `true`, disables OmO and restores the original build agent. When `false` (default), OmO replaces the build agent as the default primary agent. | ### Hooks diff --git a/src/agents/omo.ts b/src/agents/omo.ts index 4094294..932488a 100644 --- a/src/agents/omo.ts +++ b/src/agents/omo.ts @@ -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", } diff --git a/src/config/schema.ts b/src/config/schema.ts index 1beea29..bc839c6 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -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({ diff --git a/src/index.ts b/src/index.ts index 12279f0..751184f 100644 --- a/src/index.ts +++ b/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,