/** * src/extension/settings-reader.ts — concrete EnabledModelsReader over the pi * settings files (C3 model scope). * * Reads the pi `enabledModels` allowlist from the two settings tiers, with * PROJECT priority (documented tintinweb enabled-models behavior): * * 1. project /.pi/settings.json (wins when it defines the key) * 2. global ~/.pi/agent/settings.json (fallback) * * Priority semantics: when the project settings file exists AND defines * `enabledModels` (even as an empty array), the project value wins — an empty * project allowlist intentionally disables the scope check downstream (no-op * safety). When the project tier does not define the key (missing file, * unreadable/corrupt JSON, or key absent/non-array), the global tier is read * with the same rules. When neither tier defines `enabledModels`, the reader * returns undefined (scope check skipped entirely). * * Non-string entries are dropped; remaining entries are returned raw (exact * `provider/modelId` matching happens in the pure models/scope gate, where * globs/bare ids are silently ignored). * * The reader NEVER throws: any read/parse failure is reported as "tier not * configured" so a broken settings file degrades to a skipped check, never a * dispatch crash. This module is the extension layer (the only layer allowed * to touch pi settings); models/engine stay fs-free. */ import type { EnabledModelsReader } from "../models/index.js"; /** Options for {@link createPiSettingsEnabledModelsReader} (paths injectable for tests). */ export interface PiSettingsEnabledModelsOptions { /** Project settings path (default `/.pi/settings.json`). */ projectSettingsPath?: string; /** Global settings path (default `~/.pi/agent/settings.json`). */ userSettingsPath?: string; } /** Same tier paths, reused by the F3 defaultModel reader. */ export type PiSettingsTierOptions = PiSettingsEnabledModelsOptions; /** * Build the concrete pi-settings EnabledModelsReader for a repo root. * Project settings take priority over the global user settings. */ export declare function createPiSettingsEnabledModelsReader(repoRoot: string, opts?: PiSettingsEnabledModelsOptions): EnabledModelsReader; /** * F3 parent-model fallback: read the pi `defaultModel` from the same two * settings tiers as `enabledModels`, with PROJECT priority. Returns undefined * when neither tier defines a usable string (the engine then dispatches * without a parent model — no inheritance, previous behavior). Never throws. */ export declare function readPiDefaultModel(repoRoot: string, opts?: PiSettingsTierOptions): string | undefined;