/** * Profile management for @a5c-ai/agent-mux. * * Profiles are named RunOptions presets stored as JSON files in the * global config directory (`~/.agent-mux/profiles/`) or the project * config directory (`.agent-mux/profiles/`). * * @see 02-run-options-and-profiles.md §10 */ import type { AgentName, ProfileData } from './types.js'; import type { StoragePaths } from './storage.js'; import type { RunOptions } from './run-options.js'; /** Options for filtering profile listings. */ export interface ProfileListOptions { /** Filter by scope. If omitted, both global and project profiles are listed. */ scope?: 'global' | 'project'; } /** Metadata for a single profile entry in a listing. */ export interface ProfileEntry { /** Profile name (filename without `.json` extension). */ name: string; /** Where this profile is stored. `'project'` if present in both. */ scope: 'global' | 'project'; /** Whether a global profile is also present (only relevant for project scope). */ hasGlobalOverride: boolean; /** The agent specified in this profile, if any. */ agent?: AgentName; /** The model specified in this profile, if any. */ model?: string; /** `true` if the profile file exists but could not be parsed. */ corrupt?: boolean; } /** A resolved profile: the merged result of global + project data. */ export interface ResolvedProfile { /** Profile name. */ name: string; /** The resolved profile data after merging global and project layers. */ data: ProfileData; /** Source scope of the resolved profile. */ scope: 'global' | 'project'; /** Absolute path to the global profile file, if it exists. */ globalPath?: string; /** Absolute path to the project profile file, if it exists. */ projectPath?: string; } /** Options for writing a profile. */ export interface ProfileSetOptions { /** * Target scope for the profile file. * @default 'project' (if a project directory exists, else 'global') */ scope?: 'global' | 'project'; } /** Options for deleting a profile. */ export interface ProfileDeleteOptions { /** * Target scope to delete from. * If undefined, prefers project scope: deletes from project if found there, * else falls back to global. */ scope?: 'global' | 'project'; } /** * Manages named RunOptions presets (profiles). * * @see 02-run-options-and-profiles.md §10 */ export interface ProfileManager { /** List all available profiles, sorted by name. */ list(options?: ProfileListOptions): Promise; /** Show the resolved contents of a named profile. */ show(name: string): Promise; /** Create or update a named profile. */ set(name: string, data: ProfileData, options?: ProfileSetOptions): Promise; /** Delete a named profile. */ delete(name: string, options?: ProfileDeleteOptions): Promise; /** Apply a profile to partial RunOptions, returning the merged result. */ apply(name: string, overrides?: Partial): Promise>; } /** Implementation of the ProfileManager interface. */ export declare class ProfileManagerImpl implements ProfileManager { private readonly globalProfilesDir; private readonly projectProfilesDir; constructor(storagePaths: StoragePaths); list(options?: ProfileListOptions): Promise; show(name: string): Promise; set(name: string, data: ProfileData, options?: ProfileSetOptions): Promise; delete(name: string, options?: ProfileDeleteOptions): Promise; apply(name: string, overrides?: Partial): Promise>; private resolveDefaultScope; private deleteFile; private listDir; /** * Read and parse a profile JSON file. * Returns null if the file does not exist. * Returns { corrupt: true } for unparseable files (§12.5). */ private readProfileFile; }