Settings
Read your plugin's settings, save one, and react when one changes.
Availability: Both (backend ctx.settings / frontend Omniscio.settings) — onChange is panel-only Required Permission: None
Methods
getAll(): Promise<Record<string, unknown>>
Retrieve all settings for your plugin as a key-value object.
Returns: Promise<Record<string, unknown>> -- an object containing all setting keys and their current values.
Example:
// Frontend
const settings = await Omniscio.settings.getAll()
const apiUrl = settings.apiUrl as string
const maxRetries = settings.maxRetries as number
// Backend
const settings = await ctx.settings.getAll()
ctx.log.info(`API URL: ${settings.apiUrl}`)get(key: string): Promise<unknown>
Retrieve a single setting by its key.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The setting key to look up |
Returns: Promise<unknown> -- the setting value, or undefined if not set.
Example:
// Frontend
const apiKey = await Omniscio.settings.get('apiKey') as string
if (!apiKey) {
Omniscio.toast.show({
type: 'error',
message: 'Please configure your API key in Settings > Plugins',
})
}
// Backend
const interval = await ctx.settings.get('syncInterval') as number ?? 30
ctx.log.info(`Sync interval: ${interval} minutes`)set(key: string, value: unknown): Promise<void>
Save one setting. The value is merged into your plugin's stored settings — every other key keeps its current value — so a settings screen can save a single field without writing back a whole object.
Availability: Both (backend ctx.settings.set / frontend Omniscio.settings.set)
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The setting key, as declared in your manifest's settings |
value | unknown | The new value, validated against that setting's declared type |
Returns: Promise<void> — it rejects when the key is not one of your declared settings, or the value does not fit its type.
Saving also tells your backend: its onSettingsChanged(settings) hook runs with the new value, so a running plugin picks the change up without a restart.
Example:
// Frontend — a settings screen saving one field
await Omniscio.settings.set('apiUrl', input.value.trim())
// Backend
await ctx.settings.set('syncInterval', 60)onChange(callback): () => void
Run a callback every time your settings are saved from Omniscio's Settings > Plugins panel, whichever surface saved them.
Availability: Frontend only (panel Omniscio.settings.onChange). A backend reacts through its onSettingsChanged lifecycle hook instead.
Parameters:
| Name | Type | Description |
|---|---|---|
callback | (settings: Record<string, unknown>) => void | Receives the full settings object after each save |
Returns: an unsubscribe function — call it when your pane unmounts.
Example:
useEffect(() => {
const off = Omniscio.settings.onChange((settings) => {
setThemeAccent(settings.accent as string)
})
return off
}, [])Defining Settings
Settings are declared in manifest.json using the settings array. Each entry defines a key, type, label, and optional default value:
{
"settings": [
{
"key": "apiUrl",
"type": "string",
"label": "API URL",
"description": "The base URL for the API",
"default": "https://api.example.com"
},
{
"key": "maxRetries",
"type": "number",
"label": "Max Retries",
"description": "Number of retry attempts on failure",
"default": 3
},
{
"key": "enableSync",
"type": "boolean",
"label": "Enable Auto-Sync",
"default": true
},
{
"key": "apiKey",
"type": "string",
"label": "API Key",
"description": "Your API key (stored securely)"
}
]
}Omniscio renders these as a settings form in the Settings > Plugins panel. Users configure the values there, and your plugin reads them at runtime.
See Manifest > Settings for the full settings schema.
Notes
- Settings are read-only from the plugin's perspective. Plugins cannot write settings programmatically -- only the user can change them through Omniscio's UI.
- No permission is required. Every plugin can read its own settings.
- Use
getAll()when you need multiple settings at once to avoid multiple round-trips. Useget(key)when you only need a single value. - Settings values may be
undefinedif the user has not configured them and no default is set in the manifest. Always handle theundefinedcase. - Setting keys are scoped to your plugin. Two different plugins can use the same key name without conflict.