feat(deeplink): allow overriding OpenCode npm package via URL param#2187
Open
oaker-io wants to merge 1 commit into
Open
feat(deeplink): allow overriding OpenCode npm package via URL param#2187oaker-io wants to merge 1 commit into
npm package via URL param#2187oaker-io wants to merge 1 commit into
Conversation
OpenCode providers currently hard-wire `npm=@ai-sdk/openai-compatible`, which breaks imports that need a provider-specific SDK — notably Gemini-native routing, which requires `@ai-sdk/google` and can't be fixed post-import without manual JSON editing. - Add `npm: Option<String>` to `DeepLinkImportRequest` (URL param + Base64 config pass-through via `merge_additive_config`). - `build_opencode_settings` now honors the override and falls back to `@ai-sdk/openai-compatible` when absent. - Covered by three new tests (parser, default fallback, explicit override). - Documented in en / zh / ja manuals. No behavior change for existing deeplinks that don't pass `npm`.
Owner
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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
npmparameter to theccswitch://provider deeplink so callers can pick which@ai-sdk/*package the OpenCode provider should use.@ai-sdk/openai-compatible, and the user has to open the provider config and hand-editnpmto@ai-sdk/googlebefore chat works.@ai-sdk/openai-compatible, so existing deeplinks are unaffected.What changed
DeepLinkImportRequestgainsnpm: Option<String>(camelCasenpmin the URL).parse_deeplink_urlreadsnpmfrom the query string for theproviderresource.merge_additive_config(OpenCode / OpenClaw JSON config pass-through) now carriesnpmfrom the Base64 config when the URL param is absent.build_opencode_settingsuses the override and falls back to@ai-sdk/openai-compatible.5.3-deeplink.mdget a new row fornpm.Context
Example deeplink from a relay that routes Gemini under
/v1beta:Without this change the imported provider is usable for discovery but fails on the first chat because the
openai-compatibleSDK can't speak Gemini-native. With the change, one click lands a working config.Tests
test_parse_opencode_deeplink_with_npm_param— URL param survives parsing.test_build_opencode_provider_defaults_npm_when_absent— default unchanged.test_build_opencode_provider_honors_npm_override— override wins.All 24
deeplink::tests::*pass locally (cargo test deeplink).cargo fmt --checkandcargo clippy -- -D warningsclean.Test plan
cargo fmt --checkpassescargo clippy --manifest-path src-tauri/Cargo.toml -- -D warningspassescargo test --manifest-path src-tauri/Cargo.tomlpasses (24 deeplink tests + 2 integration tests)npm=@ai-sdk/googleand confirm the provider config in CC Switch shows the overridden package🤖 Generated with Claude Code