feat: add OpenCode CLI provider support#100
Open
ryanchao0518 wants to merge 5 commits intoPleasePrompto:mainfrom
Open
feat: add OpenCode CLI provider support#100ryanchao0518 wants to merge 5 commits intoPleasePrompto:mainfrom
ryanchao0518 wants to merge 5 commits intoPleasePrompto:mainfrom
Conversation
- Add opencode_provider.py: OpenCodeCLI class implementing BaseCLI - Add opencode_events.py: NDJSON stream parser for OpenCode output - Add opencode to factory.py: provider selection branch - Add opencode_cli_parameters to CLIParametersConfig and CLIServiceConfig - Add check_opencode_auth to auth.py and _CHECKERS dict - Add opencode to init_wizard.py: CLI detection and i18n - Add opencode to orchestrator/core.py: both CLIServiceConfig instances - Add opencode entry to en/wizard.toml i18n Allows /model command to switch between claude, codex, gemini, and opencode CLIs.
- Remove CLAUDE button from /model selector (claude CLI not used) - Add OPENCODE button to /model selector - Update session_help i18n: remove claude refs, add opencode refs - Update active_provider_name: remove claude, add opencode - Update provider_label maps: remove claude, add opencode - Update no_auth message to remove claude auth reference
Gemini CLI installed via Homebrew (macOS) stores gemini-cli-core in Cellar/<version>/libexec/lib/node_modules/ instead of the usual npm layout. Add _gemini_cellar_candidates() that walks up the directory tree from the package root to find the Homebrew Cellar prefix and discovers models.js there. Discovery now finds all 7 models instead of 0: - gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro - gemini-3-flash-preview, gemini-3-pro-preview - gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools
- config.py: add opencode model prefixes (minimax/, kimi-for-coding/, opencode/) to provider_for() so model IDs route to opencode provider - providers.py: add opencode to default_model_for_provider() -> minimax/MiniMax-M2.7 - providers.py: add opencode to resolve_session_directive() for @OpenCode directive - model_selector.py: add opencode branch in _build_model_step() that immediately switches to default MiniMax model without showing a picker - model_selector.py: add opencode to _handle_model_selected() switch so opencode models switch immediately (no reasoning effort picker) - _build_model_step() now takes orch+key args to support async switch
- Remove redundant double-check in _OpenCodeServer.ensure_running() (mypy incorrectly flagged second check as unreachable) - Add explicit None guards for process.stdout/stderr pipes - Change send_streaming to yield events directly via async for delegation instead of returning a coroutine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
OpenCodeCLIprovider support, remove Claude Code CLI from ductor's UI, fix Gemini CLI model discovery for Homebrew Cellar installations, and wire up opencode with MiniMax as the default model.Changes
Commit 1:
feat: add OpenCode CLI provider supportductor_bot/cli/opencode_provider.pyOpenCodeCLIclass withsend()/send_streaming()ductor_bot/cli/opencode_events.pyductor_bot/cli/factory.pycreate_cli()ductor_bot/cli/auth.pycheck_opencode_auth()+ add to_CHECKERSdictductor_bot/cli/service.pyopencode_cli_parametersfieldductor_bot/config.pyopencode: list[str]toCLIParametersConfigductor_bot/orchestrator/core.pyopencode_cli_parametersto bothCLIServiceConfiginstantiationsductor_bot/cli/init_wizard.py_check_clis()ductor_bot/i18n/en/wizard.tomlCommit 2:
refactor: remove Claude from provider UI, add OpenCode to provider listductor_bot/orchestrator/selectors/model_selector.pyductor_bot/messenger/telegram/app.pyductor_bot/orchestrator/providers.pyactive_provider_name, add "OpenCode"ductor_bot/text/response_format.pynew_session_textprovider_label mapductor_bot/i18n/en/chat.tomlno_auth,session_helpstringsCommit 3:
fix: detect Gemini CLI models.js in Homebrew Cellar layoutductor_bot/cli/gemini_utils.py_gemini_cellar_candidates()to walk up to Homebrew Cellar prefixCommit 4:
feat: wire up opencode as first-class provider with MiniMax defaultductor_bot/config.pyminimax/,kimi-for-coding/,opencode/prefixes to opencode providerductor_bot/orchestrator/providers.pydefault_model_for_provider("opencode")→minimax/MiniMax-M2.7; add opencode toresolve_session_directive()ductor_bot/orchestrator/selectors/model_selector.py_build_model_step: opencode branch immediately switches to default MiniMax model;_handle_model_selected: opencode models switch immediatelyductor_bot/orchestrator/selectors/model_selector.py_build_model_stepnow takesorch+keyargs (refactored for async switch)Model Discovery Results
minimax/MiniMax-M2.7(MiniMax series available: M2, M2.1, M2.5, M2.5-highspeed, M2.7, M2.7-highspeed)Testing
/modelshows CODEX / GEMINI / OPENCODE (no CLAUDE) ✅