fix: merge user-configured svelte-file-editor agent settings#176
Conversation
Previously, the plugin unconditionally overwrote the svelte-file-editor
agent configuration, preventing users from customizing settings like
model, variant, or other agent properties.
Now user configuration is merged with plugin defaults, with user config
taking precedence. This allows users to override model/variant in their
opencode.json:
{
"agent": {
"svelte-file-editor": {
"model": "anthropic/claude-sonnet-4-20250514",
"variant": "coding"
}
}
}
Fixes sveltejs#175
|
Someone is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 1968504 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Allows users to configure model and variant for the svelte-file-editor
agent directly in svelte.json instead of opencode.json.
Users can now set:
{
"model": "anthropic/claude-sonnet-4-20250514",
"variant": "coding"
}
in ~/.config/opencode/svelte.json or project-local .opencode/svelte.json
Fixes sveltejs#175
|
Hey the feature request is absolutely valid...however I don't think this is the right solution...the open code plugin for svelte has it's own configuration file and it would feel weird to have part of the configuration in This would also mean that if you are using the open code schema you would get warnings if you don't fill all the information (that is already filled by the plugin). I would say the best way is that we add the configuration object in the svelte.json file and we apply the configuration when adding it. I can do it if you want but if you want to update this PR I'll happily merge that. |
|
Hi @paoloricciuti, thank you for your very prompt response 🙏 Is this new one a proper solution, or just the beginning of one? |
|
@momoshell uh sorry didn't realize... I think it's just the beginning of the solution 😅 This will basically unify all the agents into the same option which is fine for now but might be annoying in the future. I'd say we can basically have the same customizations on a per-agent level. So the idea would be that in {
"agent": {
"svelte-file-editor": {
// config for svelte-file-editor
}
}
}this will allow for all the customization even for future agents. I would keep the config schema "wide" merging the current schema with a looseObject record of string -> config and then update the schema generation script to actually provide intellisense for the available agents. You can take inspiration from #174 to see how I did kinda the same for skills. |
Only agent configuration is being added, not skills. Took inspiration from PR sveltejs#174 for the intellisense pattern only.
Don't mention specific agent names in the description, similar to how skills schema doesn't mention specific skill names. Intellisense for known agents is still provided via the schema generator.
svelte.json is the canonical place for svelte-specific configuration, so it should take precedence over any agent config in opencode.json.
svelte.json is the sole source of truth for svelte agent configuration.
|
@paoloricciuti thank you for your suggestions, great stuff btw! Here's what I've tried to replicate in related files:
|
| import path from 'node:path'; | ||
|
|
||
| // Known agents that can be configured | ||
| const known_agents = ['svelte-file-editor']; |
There was a problem hiding this comment.
We can read the known agents with fs from the ./tools/agents folder so we don't have to hard code it
There was a problem hiding this comment.
Yes, that's definitely much better.
Addressed with 94953dd
packages/opencode/config.ts
Outdated
| v.object({ | ||
| enabled: v.optional(v.boolean()), | ||
| }), | ||
| agent: v.pipe( |
There was a problem hiding this comment.
We should re-use the same subagent key otherwise it will be confusing to have separate config for the same thing
There was a problem hiding this comment.
I think I got it, changes are here: a83d466
There was a problem hiding this comment.
Thanks... I'll review it properly as soon as I'm back at the desk (it could be tomorrow) 🙏🏻
There was a problem hiding this comment.
Thank you, @paoloricciuti, this was the best PR review experience I have ever had :)
And being this dialed-in is legendary.
Instead of hardcoding the list of known agents, discover them by reading .md files from the tools/agents directory. This follows the same pattern used for skill discovery and makes it easier to add new agents.
Consolidates agent configuration under subagent.agents to avoid confusion between separate 'subagent' and 'agent' config keys. Users now configure agents via subagent.agents instead of a top-level agent key.
| model: v.pipe( | ||
| v.optional(v.string()), | ||
| v.description('Model identifier for the agent (e.g., "anthropic/claude-sonnet-4-20250514")'), | ||
| ), | ||
| variant: v.pipe( | ||
| v.optional(v.string()), | ||
| v.description('Variant identifier for the agent (e.g., "coding")'), | ||
| ), |
There was a problem hiding this comment.
I was working on this to actually merge it but I was thinking...should we also give more flexibility here? Maybe someone actually wants to change the temperature or the maxSteps. I don't think soeone should change tools or permissions but maybe those things we could add.
There was a problem hiding this comment.
Maybe we should. I'm not really smart here, but I think that it boils down to personal preference.
Speaking of which, mine is to use config files [like opencode.json] to define providers, models, and variants.
Everything else, like temperature or specific permission, I keep in the prompt .md files.
And then, on the other side of things is what you've just mentioned. I guess it wouldn't hurt much to add a few additional fields, right?
There was a problem hiding this comment.
But temperature is a parameter of the subagent...I think we should add those too
There was a problem hiding this comment.
Agree then, flexibility is always appreciated 👏
There was a problem hiding this comment.
@momoshell pushed the final change...I've removed variant because it doesn't seem to be an actual configuration option for agents
There was a problem hiding this comment.
@paoloricciuti nice update, thank you very much.
I've removed variant because it doesn't seem to be an actual configuration option for agents
Just to verify, are we talking about the same thing, because this is the config param I've been using for quite some time now. Example from opencode's docs:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"openai": {
"models": {
"gpt-5": {
"variants": {
"thinking": {
"reasoningEffort": "high",
"textVerbosity": "low",
},
"fast": {
"disabled": true,
},
},
},
},
},
},
}from their Models page
There was a problem hiding this comment.
That is a configuration for the models not for the subagent...the subagent model only get the string
There was a problem hiding this comment.
Ahh, ok, now I get what you've meant, sry for the confusion.
All good then, thanks
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Description
The
@sveltejs/opencodeplugin was unconditionally overwriting thesvelte-file-editoragent configuration, preventing users from customizing settings likemodel,variant, or other agent properties.This PR changes the behavior to merge user configuration with plugin defaults, with user config taking precedence.
Reproduction
~/.config/opencode/opencode.json):{ "agent": { "svelte-file-editor": { "mode": "subagent", "model": "anthropic/claude-sonnet-4-20250514", "variant": "coding" } } }Changes
default_configvariablesvelte-file-editorconfig with defaults using spread operatorFixes #175