/** * The configuration vocabulary shared by every layer of the package (SPEC S5–S8). * * Two distinct shapes exist on purpose: * - `ConfigFile` is what an operator WRITES: everything optional, exactly the * three keys the SPEC's config schema names, nothing more. * - `EffectiveConfig` is what the extension READS after merge: every route * fully resolved, so no downstream code has to reason about optionality. */ import type { PathProtectionOverride, ResolvedPathPolicy } from "./path-policy.js"; /** Pi's thinking levels, mirrored here so the domain layer stays Pi-free. */ export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"]; export type ThinkingLevel = (typeof THINKING_LEVELS)[number]; /** A thinking level, or `inherit` = "whatever the session already uses". */ export type ThinkingSetting = ThinkingLevel | "inherit"; /** `"inherit"` or an exact `provider/modelId` reference (split at the first slash). */ export type ModelRef = `${string}/${string}`; /** An ordered fallback chain of references; the first resolvable + configured entry wins (issue #154, root cause E). */ export type ModelChain = readonly ModelRef[]; /** * `"inherit"`, one reference, or an ordered fallback chain of 1–4 references. * A chain is probed by order, and the first entry that resolves AND has * configured auth is applied (OB-6, OB-8, OB-9). */ export type ModelSetting = "inherit" | ModelRef | ModelChain; /** Cap on chain length (issue deliberation: 8 was "almost certainly a mistake"; 4 keeps the view readable). */ export declare const MAX_MODEL_CHAIN = 4; export declare const PROFILE_FALLBACK_APPLY_TO: readonly ["flow", "command"]; export type ProfileFallbackApplyTo = (typeof PROFILE_FALLBACK_APPLY_TO)[number]; export declare const PROFILE_FALLBACK_RESUME: readonly ["continue", "restart"]; export type ProfileFallbackResume = (typeof PROFILE_FALLBACK_RESUME)[number]; export interface ProfileFile { default?: RouteFile; commands?: Record; } export interface ProfileFallbackConfig { applyTo: ProfileFallbackApplyTo; resume: ProfileFallbackResume; retryAfterSeconds: number; } export declare const DEFAULT_PROFILE_FALLBACK: Readonly; export interface ProfileCandidate { profile: string; builtIn: boolean; route: Route; declared: { model: boolean; thinking: boolean; }; } export interface Route { model: ModelSetting; thinking: ThinkingSetting; } /** Feature 63: which route keys a scope actually declared (vs. the shipped inherit). */ export interface RouteDeclaration { model: boolean; thinking: boolean; } /** What one config file may declare (SPEC "Config schema"). */ export interface RouteFile { model?: ModelSetting; thinking?: ThinkingSetting; } export interface ConfigFile { default?: RouteFile; commands?: Record; onUnavailableRoute?: UnavailableRoutePolicy; /** What happens to the routed model and thinking level after the command settles. */ onSettle?: SettlePolicy; /** The tighten-only path-protection override (feature 60, AC10). */ pathProtection?: PathProtectionOverride; /** Conductor (advance) knobs (feature 62). */ advance?: AdvanceConfigFile; /** When true (default), the built-in provider profiles are included in the * resolution chain (feature 63, AC1). */ recommendedModels?: boolean; /** Feature 66 (AC3/D3): the memory-substrate consent surface — Engram's MCP * registration is ask-first, so nothing is provisioned unless this says so. */ memory?: MemoryConfigFile; /** Named user profiles keyed by profile name (feature 63, AC5). */ profiles?: Record; /** Ordered list of profile names to probe; empty means ["default"] only * (feature 63, AC6). */ profileOrder?: string[]; /** Partial override for the profile-fallback demotion policy (feature 63). */ profileFallback?: Partial; } export type UnavailableRoutePolicy = "stop" | "inherit"; /** * What the session holds after a routed command settles. * - `"keep"` — the routed model and thinking level stay in the open chat window, * so a follow-up edit or question keeps running on the model that planned it. * - `"restore"` — the pre-dispatch model and thinking level come back (AC8). */ export type SettlePolicy = "keep" | "restore"; /** One rejected field inside one config file, addressed by a JSON-path-ish string. */ /** What an operator WRITES under `memory` (feature 66). */ export interface MemoryConfigFile { /** Opt in to the package registering the Engram MCP server when its binary * resolves. Absent or `false` registers nothing. */ engram?: boolean; } /** What the extension READS: every `memory` knob resolved (feature 66). */ export interface MemoryConfig { engram: boolean; } export interface ConfigIssue { path: string; message: string; } export declare const UNAVAILABLE_ROUTE_POLICIES: readonly UnavailableRoutePolicy[]; export declare const SETTLE_POLICIES: readonly SettlePolicy[]; export interface EffectiveConfig { default: Route; commands: Record; onUnavailableRoute: UnavailableRoutePolicy; onSettle: SettlePolicy; /** The effective path-protection policy: the shipped floor tightened by any override. */ pathProtection: ResolvedPathPolicy; /** The effective advance (conductor) knobs (feature 62). Resolved by * mergeConfigs; the shipped DEFAULT_CONFIG predates it and leaves it * absent — consumers fall back to DEFAULT_ADVANCE_CONFIG. */ advance?: AdvanceConfig; /** Whether the built-in provider profiles (currently only "nan") are * included in the resolution chain (feature 63, AC1). */ recommendedModels: boolean; /** Named user profiles keyed by profile name (feature 63, AC5). */ profiles: Record; /** Ordered list of profile names to probe (feature 63, AC6). */ profileOrder: string[]; /** The effective profile-fallback demotion policy (feature 63). */ profileFallback: ProfileFallbackConfig; /** Feature 66: the memory-substrate consent surface. */ memory: MemoryConfig; /** Feature 63: declaredness of the implicit `default` profile. */ declared: { default: RouteDeclaration; commands: Record; }; } export interface ConfigProblem { scope: "global" | "project"; path: string; message: string; } /** Absolute paths of the two dedicated JSON files (never Pi `settings.json`). */ export interface ConfigPaths { global: string; project: string; } /** Per-iteration control knobs for the conductor loop. */ export interface AdvanceConfigFile { iterationsCap?: number; sensitivePaths?: string[]; securityPaths?: string[]; runLogPath?: string; } /** Effective advance configuration with all fields resolved. */ export interface AdvanceConfig { iterationsCap: number; sensitivePaths: string[]; securityPaths: string[]; runLogPath: string; } /** The shipped advance defaults (mirrors conductor DEFAULT_CONDUCTOR_CONFIG). */ export declare const DEFAULT_ADVANCE_CONFIG: Readonly;