Skip to content

settings.set

Applies settings at once until the daemon restarts or the next workspaces.reload_init; nothing is written: to keep a value, declare it with ctx.settings in the user’s init.ts (DMN-1206).

/**
* `settings.set` params: values applied over the declared ones until the daemon restarts or the next
* `workspaces.reload_init` (DMN-1206); nothing is written. Absent ones are unchanged.
*/
export type SetSettingsParams = {
/** Daemon-wide values to set (PRT-231); absent fields are unchanged. */
daemon?: DaemonSettings | null;
/** Bindings replacing the ones with the same mode and keys (`command: ""` unbinds the default). */
keymap?: KeymapEntry[] | null;
/** UI values to set; absent fields are unchanged. */
ui?: UiSettings | null;
};
/**
* The effective daemon-wide settings (DMN-1272, DMN-1206, UI-097): what the user's init file declares (`ctx.settings`,
* `ctx.keys.bind`), with the runtime changes of `settings.set` over it.
*/
export type Settings = {
/** What the user's init file declares for every workspace's agents (DMN-1204); absent when it declares none. */
agents?: AgentsSettings | null;
/** Daemon-wide values a window may change live (PRT-231); absent when nothing sets them. */
daemon?: DaemonSettings | null;
/** Why the user's init file failed to load in the user host (its settings do not apply); `null` otherwise. */
error: string | null;
/**
* Bindings over the defaults: the user's `ctx.keys.bind` in declaration order, then the `settings.set` ones;
* `command: ""` removes a default binding.
*/
keymap: KeymapEntry[];
/**
* The shell's slots the user's init file fills (`ctx.shell.slot(name, ref)`, e.g. a flavor's `left`), by slot: a
* widget reference as declared, a module path as `./widgets/shell.<slot>`, the user's widget of that name (the
* index's `widgets`, PRT-611). Every window shows them, before any workspace and under a workspace's own slots;
* absent when it fills none.
*/
shell?: Record<string, string> | null;
/** How the daemon resumes interrupted turns by itself (DMN-1228, DMN-1229); absent when nothing declares it. */
threads?: ThreadsSettings | null;
ui: UiSettings;
/**
* The user's init file's default view (a flavor's): a window shows it while a workspace's views have not arrived
* (UI-100), as the daemon serves it to a workspace whose host is still loading; absent when it declares no view.
*/
views?: SettingsViews | null;
};
/** Daemon-wide values that apply without a restart (PRT-231); an absent value is the default. */
export type DaemonSettings = {
/**
* How long a thread stays archived before the daemon deletes it (DMN-1061, PRT-231): `<n>m`, `<n>h`, `<n>d` or
* `<n>w`, or `never` (also `0`) to keep archived threads; absent is `7d`.
*/
deleteArchivedAfter?: string | null;
/**
* How long a hung-up terminal's process group may take to end before the daemon SIGKILLs it (TRM-200, PRT-231),
* in milliseconds, a whole number from 0; absent is 2000.
*/
terminalHangUpGraceMs?: number | null;
};
/** One key binding over the defaults (UI-097): the user's `ctx.keys.bind` (DMN-1272) or a `settings.set` one. */
export type KeymapEntry = {
/** Arguments passed to the command. */
args?: string[];
/** Command id; `""` removes the default binding of `keys`. */
command: string;
/** Key sequence, e.g. `g g`, `Ctrl-d`, `Space n`. */
keys: string;
mode: KeymapMode;
};
/** The UI's settings; an absent value is the default (UI-097). */
export type UiSettings = {
density?: Density | null;
desktop?: DesktopSettings | null;
/** Root font size in px (10..=28, default 17); every rem-based size token scales with it. */
fontSize?: number | null;
fonts?: FontSettings | null;
motion?: Motion | null;
notifications?: NotificationMode | null;
/**
* How many hidden threads each window keeps followed for a quick return (UI-996): a number (0..=100, default 20)
* or `"all"`. Their states stay in the window's memory, but their thread hosts are not kept alive (PRT-222).
*/
recentThreads?: RecentThreads | null;
/** Show informational xdev notices in the transcript (UI-043); absent or false hides them, without dropping events. */
showXdevNotices?: boolean | null;
/** The skin (UI-794): `crush` (absent, the default) or the opt-in `boring`; independent of `theme`. */
skin?: Skin | null;
/**
* The colour theme (UI-510); absent is Synth, omfp's own. The windows apply the user theme (`/theme.css`) only
* with `matugen`.
*/
theme?: BuiltinTheme | null;
};
/**
* Per-workspace settings of the agents (DMN-1204, AGT-411): the user's init file declares them for every workspace, a
* workspace's `.omfp/init.ts` overrides them there; an absent value is the default.
*/
export type AgentsSettings = {
/**
* Whether threads get pi's `codemode` tool, which runs a JavaScript script calling the other tools (default `true`,
* AGT-412). Read when a thread's host starts; a change restarts idle threads.
*/
codemode?: boolean | null;
/**
* pi's automatic compaction (AGT-434). Read when a thread's host starts; a change restarts idle threads.
*/
compaction?: AgentCompactionSettings | null;
/** The background jobs agents start (AGT-461, AGT-462). */
jobs?: AgentJobsSettings | null;
/**
* How deep child threads nest (1..=8, default 2): threads above this depth (a thread without a parent is 0, its
* children 1) have the `task` tool, and `threads.create` refuses a child deeper. Read when a thread's host starts; a change restarts idle threads.
*/
maxDepth?: number | null;
/**
* The model new threads start with, `<provider>/<id>` (DMN-1362): stored with each thread when it is created, unless
* it is created with a model of its own or is a child taking its parent's. Absent: the daemon's `--model`. Existing
* threads keep theirs.
*/
model?: string | null;
/**
* How pi delivers queued steers and follow-ups (DMN-1361). Read when a thread's host starts; a change restarts idle
* threads.
*/
queue?: AgentQueueSettings | null;
/**
* pi's automatic retries (AGT-435). Read when a thread's host starts; a change restarts idle threads.
*/
retry?: AgentRetrySettings | null;
/** The subagents' `budget` (AGT-467). */
subagents?: AgentSubagentsSettings | null;
/**
* The thinking level new threads start with (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`; DMN-1362),
* stored with each thread as `model` is.
*/
thinkingLevel?: string | null;
};
/**
* Resuming interrupted turns without the user (DMN-1228, DMN-1229), declared in the user's init file; an absent
* value is the default.
*/
export type ThreadsSettings = {
/** Whether the daemon resumes interrupted turns itself, as `thread.resume` does (default `false`). */
autoResume?: boolean | null;
/** How many times a thread whose host keeps crashing is resumed within the window (default 3). */
autoResumeCrashLimit?: number | null;
/** The window of `autoResumeCrashLimit`, in minutes (default 10). */
autoResumeCrashWindowMinutes?: number | null;
};
/** The views of {@link Settings}. */
export type SettingsViews = {
/** The view a views manifest's `default` would pick among the user's: id `default`, else the first by id. */
default: SettingsView;
};
/** The keymap mode a binding belongs to: `normal` (the layer Threads and View mode share), `threads`, `view`, `insert` or `cmdline`. */
export type KeymapMode = "normal" | "threads" | "view" | "insert" | "cmdline";
/** Row height and spacing of the UI. */
export type Density = "compact" | "normal";
/**
* The desktop app's own settings (UI-1100): where it saves downloads and what its pages may use. An absent value is
* the default; they apply to the windows on this daemon, on the machine showing them.
*/
export type DesktopSettings = {
/**
* The folder downloads go to (UI-791): an absolute path, or `~/…` in the home folder; absent is the system's
* Downloads folder (`~/Downloads` when the system names none).
*/
downloads?: string | null;
/**
* The permissions omfp's own page gets (DMN-182), Electron's names with `microphone` and `camera` for media; absent
* is `notifications`, `microphone`, `clipboard-read` and `clipboard-sanitized-write`.
*/
pagePermissions?: string[] | null;
/** How long a page's popup waits for its widget to show it (UI-698), in seconds (1..=300); absent is 10. */
popupWait?: number | null;
/**
* The permissions the widgets' web pages get (UI-682), the same names; absent is `clipboard-sanitized-write` (a
* page's copy button).
*/
webPermissions?: string[] | null;
};
/** CSS `font-family` values overriding the font tokens; absent ones keep the theme's. */
export type FontSettings = {
code?: string | null;
prose?: string | null;
ui?: string | null;
};
/** How much the UI animates (UI-145); `prefers-reduced-motion: reduce` caps it at `none`. */
export type Motion =
/** Every effect of the motion catalogue (default). */
| "full"
/** State indicators and short UI feedback only, with a steady caret. */
| "reduced"
/** No animation or transition. */
| "none";
/** When the UI shows system notifications (UI-096). */
export type NotificationMode =
| "always" | "never"
/** Only while the window has no focus (default). */
| "background";
/**
* How many hidden threads a window keeps followed (UI-996): at most a number (0..=100; 0 keeps none), or `"all"`,
* every thread shown in the window until it is closed or reloaded.
*/
export type RecentThreads = number | AllThreads;
/** The look of the whole UI (UI-794): Crush (default) or the opt-in boring skin. Any palette works with either. */
export type Skin =
/** omfp's own look (UI-120): monospace chrome, box-drawing glyphs, gradients and motion (default). */
| "crush"
/** Calm and neutral (UI-795): system sans-serif, gray chrome, light borders, no decorative motion. */
| "boring";
/**
* A colour theme of the UI (UI-510): an official palette mapped onto the Material 3 roles in light and dark,
* one of omfp's calm palettes for the boring skin (UI-794), one derived from the system accent colour where the web
* view exposes it (`accent`, UI-512), or the user theme (`matugen`, DMN-1273).
*/
export type BuiltinTheme =
/** omfp's own palette, cyan to indigo (UI-139; default). */
| "synth"
/** Catppuccin: Latte in light, Mocha in dark. */
| "catppuccin"
/** Gruvbox light and dark. */
| "gruvbox"
/** Tokyo Night: Day in light, Night in dark. */
| "tokyo-night"
/** Nord: Snow Storm surfaces in light, Polar Night in dark. */
| "nord"
/** Solarized light and dark. */
| "solarized"
/** Rosé Pine: Dawn in light, the main variant in dark. */
| "rose-pine"
/** Cool neutral grays with a restrained indigo accent (inspired by Linear). */
| "graphite"
/** Warm off-white or warm charcoal with a muted blue accent (inspired by Notion). */
| "paper"
/** Ivory or warm dark with a terracotta accent (inspired by claude.ai). */
| "clay"
/** GitHub's Primer light and dark (MIT-licensed primitives). */
| "primer"
/** Follows the system accent colour (macOS); elsewhere Synth. */
| "accent"
/** The user theme (DMN-1273: `theme.set`, the theme file matugen writes) over Synth; Synth without one. */
| "matugen";
/**
* `agents.compaction` (AGT-434): whether pi compacts a thread's context when it fills up or overflows, then goes on
* (`enabled`, default `true`), and pi's knobs: the tokens kept free for the prompt and the reply (`reserveTokens`,
* pi's default 16384) and the recent tokens kept as they are (`keepRecentTokens`, default 20000). A declaration may
* give `true` or `false` for `{ enabled }`.
*/
export type AgentCompactionSettings = {
enabled?: boolean | null;
keepRecentTokens?: number | null;
reserveTokens?: number | null;
};
/**
* `agents.jobs` (AGT-460..AGT-462): how long `job_start`'s `ready` waits without its own `timeout`
* (`readyTimeoutSeconds`, default 30), how many lines matching a job's `notify` may come within how long
* (`notifyMaxLines`, default 10, within `notifyWindowSeconds`, default 5) before its notices stop, and how long a
* `notify` or `ready.log` pattern may take on one output line before it is given up (`patternTimeoutMs`, default 250).
* Read when a job starts.
*/
export type AgentJobsSettings = {
notifyMaxLines?: number | null;
notifyWindowSeconds?: number | null;
patternTimeoutMs?: number | null;
readyTimeoutSeconds?: number | null;
};
/**
* `agents.queue` (DMN-1361, AGT-506): how pi delivers the messages queued while a thread's agent works. `steering`
* (default `all`): the steers queued during a turn go in together after it, or one per turn; `followUp` (default
* `one-at-a-time`): the follow-ups go in one per run, or together when the run ends.
*/
export type AgentQueueSettings = {
followUp?: AgentQueueMode | null;
steering?: AgentQueueMode | null;
};
/**
* `agents.retry` (AGT-435): whether pi retries a model call failing with a transient provider error (overloaded, rate
* limited, 5xx) after a growing delay (`enabled`, default `true`), and pi's knobs: how many times (`maxRetries`,
* default 3), the first delay, doubled at each attempt (`baseDelayMs`, default 2000), and the longest delay
* (`maxDelayMs`, pi's default). A declaration may give `true` or `false` for `{ enabled }`.
*/
export type AgentRetrySettings = {
baseDelayMs?: number | null;
enabled?: boolean | null;
maxDelayMs?: number | null;
maxRetries?: number | null;
};
/**
* `agents.subagents` (AGT-467): what a `task` item's `budget` (model requests) does: at `budgetNoticePercent` of it
* (default 100) the subagent is told once to wrap up; at `budgetStopPercent` of it (default 150) it is stopped. Read
* at each model request of a subagent with a budget.
*/
export type AgentSubagentsSettings = {
budgetNoticePercent?: number | null;
budgetStopPercent?: number | null;
};
/** A view as a views manifest holds it, with its id. */
export type SettingsView = {
id: string;
title: string;
/** A widget name, `[widget, props]` or `[container, props, ...children]`. */
layout: unknown;
};
/** `"all"`: no bound on the threads a window keeps (UI-996). */
export type AllThreads = "all";
/** How pi delivers the messages of one queue (AGT-506): every queued one at once, or one at a time. */
export type AgentQueueMode = "all" | "one-at-a-time";