Skip to main content

Module settings

Module settings 

Source
Expand description

~/.rpi/agent/settings.json — saved user defaults. Mirrors the slice of pi’s Settings interface (packages/coding-agent/src/core/settings-manager.ts) that rpi honors: defaultProvider / defaultModel / defaultThinkingLevel (consumed by provider::resolve as pi’s findInitialModel step 3 — the saved default, when authed, wins over the built-in fallback), theme, packages, and configurable resource directories.

pi’s Settings carries ~40 fields; rpi reads the fields it uses and drops the rest (serde default ignores unknown fields), so a copied pi settings.json parses clean.

Structs§

Settings
The honored subset of pi’s Settings. Unknown fields are ignored.

Functions§

load_project_settings
Load project-local settings in precedence order: .rpi/settings.json, then legacy .pi/settings.json. Both files may contribute additional resource paths; the preferred .rpi file is returned first so its paths register before legacy Pi paths. Malformed or unreadable optional project settings are ignored, matching the best-effort behavior of resource-dir discovery; global settings remain available through load_settings.
load_project_settings_with_paths
Load project settings together with their source paths. The path is kept so callers can preserve .rpi before .pi ordering even when only one of the two files exists.
load_settings
Load ~/.rpi/agent/settings.json. Missing file ⇒ Settings::default() (not an error). Malformed JSON ⇒ ConfigError::Json. Tolerates // line comments (a copied pi settings.json may contain them).
resolve_configured_paths
Resolve a configured path relative to its settings owner. Absolute paths are preserved; empty entries are ignored.
save_settings
Persist the honored settings back to ~/.rpi/agent/settings.json. Unknown pi fields (which Settings doesn’t model) are preserved: the current file is read as raw JSON, the known fields are overlaid, and the merged object is written — so a copied pi settings.json survives edits without losing pi-only keys. Missing file ⇒ a fresh object. Best-effort errors are returned as strings for the caller to surface.