/** * Agent registry for managing AI agent implementations * Singleton registry that maps agent names to implementations */ import type { Config } from "../../cli/config.js"; /** * Canonical agent names used as UIDs in the registry. * Each Agent.name must match one of these values. */ export type AgentName = "claude-code" | "cursor-agent"; /** * Result of validation check */ export type ValidationResult = { valid: boolean; message: string; errors?: Array | null; }; /** * Loader interface for feature installation * Each loader handles installing/uninstalling a specific feature (config, profiles, hooks, etc.) */ export type Loader = { name: string; description: string; run: (args: { config: Config; }) => Promise; uninstall: (args: { config: Config; }) => Promise; validate?: (args: { config: Config; }) => Promise; }; /** * LoaderRegistry interface that agent-specific registries must implement. * Each agent maintains its own singleton registry class that implements this interface. * * IMPORTANT: All agents MUST include the config loader in their registry. * The config loader (from @/cli/features/config/loader.js) manages the shared * .nori-config.json file and must be included for proper installation/uninstallation. */ export type LoaderRegistry = { /** Get all registered loaders in installation order */ getAll: () => Array; /** Get all registered loaders in reverse order (for uninstall) */ getAllReversed: () => Array; }; /** * Profile metadata returned by listSourceProfiles */ export type SourceProfile = { name: string; description: string; }; /** * Global loader metadata for uninstall prompts */ export type GlobalLoader = { /** Loader name (matches Loader.name) */ name: string; /** Human-readable name for display in prompts */ humanReadableName: string; }; /** * Agent interface that each agent implementation must satisfy */ export type Agent = { /** Unique identifier used as registry key, e.g., "claude-code" */ name: AgentName; /** Human-readable name, e.g., "Claude Code" */ displayName: string; /** Get the LoaderRegistry for this agent */ getLoaderRegistry: () => LoaderRegistry; /** List installed profiles for this agent (from ~/.{agent}/profiles/) */ listProfiles: (args: { installDir: string; }) => Promise>; /** List profiles from package source directory (for install UI) */ listSourceProfiles: () => Promise>; /** Switch to a profile (validates and updates config) */ switchProfile: (args: { installDir: string; profileName: string; }) => Promise; /** Get global loaders (installed to home directory) with their human-readable names */ getGlobalLoaders: () => Array; }; /** * Registry singleton for managing agent implementations */ export declare class AgentRegistry { private static instance; private agents; private constructor(); /** * Get the singleton instance * @returns The AgentRegistry singleton instance */ static getInstance(): AgentRegistry; /** * Reset the singleton instance (for testing) */ static resetInstance(): void; /** * Get an agent by name * @param args - Configuration arguments * @param args.name - The agent name to look up (validated at runtime) * * @throws Error if agent not found * * @returns The agent implementation */ get(args: { name: string; }): Agent; /** * List all registered agent names * @returns Array of valid agent names */ list(): Array; } //# sourceMappingURL=agentRegistry.d.ts.map