import type { Api, Model } from '@earendil-works/pi-ai'; import type { ExtensionContext } from '@earendil-works/pi-coding-agent'; /** A per-folder model pin: the provider + model id to apply in that folder. */ export interface FolderModel { provider: string; model: string; } /** The registry file: absolute folder path -> pinned model. */ export type Registry = Record; /** * Reserved registry key for the FALLBACK default, applied in any folder that has * no pin of its own. `resolve()` always yields an absolute path, so a real * folder key can never be `"*"`: it can only be written via setDefaultModel(). * * Why it matters: without this default, an unpinned folder falls through to * pi's GLOBAL default, which is whatever model you last switched to elsewhere. * The `"*"` entry is this extension's own stable default, so an unpinned folder * lands on it instead of drifting with the global. */ export declare const DEFAULT_KEY = "*"; /** Path to the home-level registry (honors the PI_CODING_AGENT_DIR override). */ export declare function registryPath(): string; /** Read the whole registry; returns {} on missing/corrupt file (never throws). */ export declare function readRegistry(path?: string): Registry; /** The pin for a folder, if any. Folder keys are normalized with resolve(). */ export declare function getFolderModel(cwd: string, path?: string): FolderModel | undefined; /** The fallback default (the `"*"` entry), if any. */ export declare function getDefaultModel(path?: string): FolderModel | undefined; /** * The model to apply in `cwd`, resolving the folder pin first and the fallback * default second. `source` says which layer won, so callers can label the * status line (`folder:` vs `default:`). Returns undefined only when neither * layer is set (pi's own global default then stands). */ export declare function resolvePin(cwd: string, path?: string): { pin: FolderModel; source: 'folder' | 'default'; } | undefined; /** * Set (or with pin=undefined, clear) the entry for one folder. Folder keys are * normalized with resolve(). Returns the written registry. */ export declare function setFolderModel(cwd: string, pin: FolderModel | undefined, path?: string): Registry; /** * Set (or with pin=undefined, clear) the fallback default (the `"*"` entry). * Returns the written registry. */ export declare function setDefaultModel(pin: FolderModel | undefined, path?: string): Registry; /** * Injectable deps so tests can point the registry at a temp file WITHOUT the * real agent dir or env (mirrors pi-webveil's `deps` seam). Defaults to the * home-level `getAgentDir()` registry. */ export interface FolderModelDeps { registryPath?: string; } /** The slice of pi's extension API this extension uses. */ export interface PiLike { registerCommand(name: string, def: { description: string; handler: (args: string | undefined, ctx: ExtensionContext) => Promise | void; }): void; setModel(model: Model): Promise; on(event: 'session_start', handler: (event: unknown, ctx: ExtensionContext) => Promise | void): void; } /** * Register the `/fmodel` command and the session-start apply hook. * * - `/fmodel` open selector, pin + apply for this folder * - `/fmodel provider/model` pin + apply this folder directly * - `/fmodel clear` remove this folder's pin * - `/fmodel default` open selector, set + apply the fallback * - `/fmodel default provider/model` set + apply the fallback directly * - `/fmodel default clear` remove the fallback default * * The fallback default (the `"*"` entry) is what an unpinned folder lands on * instead of pi's GLOBAL default (which drifts to whatever you last picked * elsewhere). pi's settings.json is never touched. */ export default function folderModelExtension(pi: PiLike, deps?: FolderModelDeps): void; //# sourceMappingURL=index.d.ts.map