0102. Plugin settings shown only for the choices they apply to
- Status: Accepted
- Date: 2026-11-27
Context
A plugin with several ways of working, such as the digest summary with Claude or a self-hosted model, has settings that apply to only one of them. The settings form showed every setting, so admins saw an Anthropic key and model beside an Ollama URL, context, and thinking switch, and could not tell which applied.
Decision
- Plugin API 0.1.3 adds the mark
shownWhen, set byshownWhen(condition, schema): setting names and values,{ provider: ['ollama', 'openai'] }. The form shows the setting only while each setting named has one of the values given. - The registry refuses a plugin whose condition names a setting that is not another top-level choice (
z.enum) or boolean of the same scope, or a value that is not one of its own. The mark is top-level only, like the others. - A hidden setting keeps its value, is saved as it is, and is still parsed by the schema; plugins check what each choice needs with refinements.
Consequences
- Settings forms show only what applies to the choices made, with no logic in the web app beyond comparing values.
- Plugins using
shownWhenneed plugin API 0.1.3 (apiVersion: '^0.1.3'); older servers would not load them, as the helper is missing there. - Conditions are plain equality on one scope's choices: no other comparisons, and no conditions across scopes.