Improve local target setup for default and custom backends#1
Conversation
Let the plugin discover supported local providers on their default URLs so setup can succeed without manual target entry. Update the OpenCode plugin dependencies to 1.4.0 and expose the Exo test port for the provider suite.
Make built-in localhost targets available by default at runtime and add a CLI auth flow for saving custom targets without editing config manually.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccb21cc931
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| const key = next === "none" ? "" : next || prev | ||
| const saveKey = next === "none" ? "" : next || undefined | ||
| const prev = cur.targets[id] | ||
| if (prev && prev.url !== baseURL(raw)) return { type: "failed" as const } |
There was a problem hiding this comment.
Allow custom target URL updates for existing IDs
Remove this guard or change it to permit updates, because it makes the new CLI custom-target flow unable to correct an existing target ID when the URL changes (or was entered incorrectly). With the current early return, authorize fails before probing/saving whenever the same target already exists with a different URL, so users cannot fix the target through CLI and must manually edit config, which contradicts the intended "CLI only" custom-target workflow.
Useful? React with 👍 / 👎.
| "provider": { | ||
| "local": { | ||
| "name": "Local Provider", | ||
| "npm": "@ai-sdk/openai-compatible", |
There was a problem hiding this comment.
Remove this explicit npm, the plugin adds it dynamically to each model definition
| try { | ||
| await saveProviderTarget(ctx.serverUrl, ctx.client, id, raw, kind) | ||
| } catch { | ||
| const now = await getCurrentProviderConfig(ctx.serverUrl, ctx.client).catch(() => undefined) | ||
| if (now?.targets[id]?.url !== baseURL(raw)) return { type: "failed" as const } | ||
| } |
There was a problem hiding this comment.
This error handling is bizarre, why?
Summary
Verification