Repository navigation
Conversation
Locates the config file that already supplies opencodeProvider/opencodeModel (project file first, then the first global file) and rewrites just those two values in place, keeping comments, trailing commas and CRLF. The rewritten text is re-parsed before an atomic write, so a bad edit never lands.
The host already lists connected providers; cache that directory on the plugin side because the lazy V2 client only proxies session calls. GET/PUT /api/config/model-provider then lets the web UI read the directory and save an explicit provider/model for tag migration, reloading config in place.
Tag migration rejects the inherit model because it has no live session, so the dialog now shows the configured provider/model, lists connected providers and their models, and saves a selection before starting. The start button stays disabled until a concrete model is configured.
The block-comment scan treated any /* in a line, including one inside a line comment such as "Protects /api/* with a token.", as opening a block, so every later key was skipped and each save appended another pair. Track the comment state per line instead, and reload through the plugin config instance because the lazily imported module is a second copy under bundling.
The tag migration dialog could pick a provider and model, but only when it opened on its own. The sidebar now links to /model-settings, which renders the same picker as a page, plus a note that the two keys are shared with auto-capture.
Drop the unused onSaved callback and the extra padding wrapper inside BorderedPanel, which already supplies its own. README now lists six views.
Sim mode had no answer for /api/config/model-provider, so the picker always showed the unavailable branch. Serve the catalog from a fixture and keep PUT selections for the session, matching the other simulated mutations.
This branch has not been deployed
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
Fixes #514.
Tag migration and auto-capture share
opencodeProvider/opencodeModel. On the migration path there is no live session, so"inherit"cannot resolve (isOpencodeTagMigrationConfigured()rejects it) and the only workaround today is hand-editingopencode-mem.jsoncand restarting. This adds a model picker to the web UI:GET/PUT /api/config/model-provider: a provider/model catalog for the connected providers, plus a writer that updates the existing jsonc config in place. Comments, trailing commas and every other key are preserved; the result is re-parsed before it is written, and the write goes through a temp file + rename, so a failure leaves the original file untouched.ctx.provider.list()+ctx.model.list()), with the legacyclient.provider.list()path as a fallback for v1.reloadConfigcallback, because a lazily imported copy of the config module is a second instance when the plugin is bundled.ModelPickerused by the tag migration dialog and by a new sidebar page Model (/model-settings). The dialog disables Start migration until an explicit model is configured.OPENCODE_MEM_SIM=1) serves the new endpoints, so the picker works offline inbun run web:dev.src/services/model-config-writer.tsand has 12 unit tests.The external channel (
memoryModel/memoryApiUrl/memoryApiKey) is intentionally out of scope: it needs key input, which belongs in a separate change.Test plan
OPENCODE_MEM_SIM=1dev server)getAutoCaptureProviderStatus()still treatsinheritas ready — deliberately untouched here.Commands:
bun test— 1247 pass, and the 5–7 failures are the same ones a cleanmainproduces in this environment (onnxruntime resolve shim, memory profile runtime timeouts, one portability test under load).tests/model-config-writer.test.tsis 12/12.bun run typecheck,bun run check,bun run web:build— pass (svelte-checkreports 0 errors).magpie/auto/glm-5.3-flash, saved, verified comments and trailing commas survived and the file has each key exactly once, confirmed the dialog's Start button becomes enabled without a restart; then savedinheritagain and confirmed the dialog goes back to "needs an explicit model".Checklist
main(do not open PRs from commits already onmain)bun testpasses (or N/A)bun run typecheckpasses (or N/A)bun run checkpasses (format + lint + typecheck; or N/A)