/**
 * Configuration management for Nori Skillsets installer
 * Functional library for loading and managing disk-based configuration
 */
/**
 * Registry authentication credentials
 * Supports both legacy password auth and new refresh token auth.
 * If `apiToken` is set, the orgId is parsed from the token itself (see `extractOrgIdFromApiToken`).
 */
export type RegistryAuth = {
    username: string | null;
    registryUrl: string;
    refreshToken?: string | null;
    idToken?: string | null;
    idTokenExpiresAt?: number | null;
    apiToken?: string | null;
};
/**
 * Authentication credentials - supports legacy password, refresh token, and API token auth.
 * API tokens are self-describing: the orgId is embedded in the token format `nori_<orgId>_<64hex>`.
 */
export type AuthCredentials = {
    username?: string | null;
    organizationUrl: string;
    refreshToken?: string | null;
    idToken?: string | null;
    idTokenExpiresAt?: number | null;
    password?: string | null;
    apiToken?: string | null;
    organizations?: Array<string> | null;
    isAdmin?: boolean | null;
};
/**
 * Unified configuration type for Nori Skillsets
 * Contains all persisted fields from disk plus required installDir
 */
export type Config = {
    auth?: AuthCredentials | null;
    sendSessionTranscript?: "enabled" | "disabled" | null;
    autoupdate?: "enabled" | "disabled" | null;
    installDir: string;
    /** Default agents for CLI operations (set via `nori-skillsets config`) */
    defaultAgents?: Array<string> | null;
    /** The currently active skillset, shared across all agents */
    activeSkillset?: string | null;
    /** Organization ID for transcript uploads (e.g., "myorg" -> https://myorg.noriskillsets.dev) */
    transcriptDestination?: string | null;
    /** Whether to delete transcript files after successful upload */
    garbageCollectTranscripts?: "enabled" | "disabled" | null;
    /** Whether to prompt to re-download skillsets from registry on switch */
    redownloadOnSwitch?: "enabled" | "disabled" | null;
    /** Whether Claude Code skillset apply configures the Nori status line */
    claudeCodeStatusLine?: "enabled" | "disabled" | null;
};
export declare const hasUnexpiredRegistryIdToken: (args: {
    auth?: AuthCredentials | null;
    now?: number | null;
}) => boolean;
export declare const hasRegistryAuthCredentials: (args: {
    auth?: AuthCredentials | null;
    now?: number | null;
}) => boolean;
export declare const toRegistryAuth: (args: {
    auth: AuthCredentials;
    registryUrl: string;
}) => RegistryAuth;
/**
 * Get the path to the config file
 * Always returns ~/.nori-config.json
 *
 * @returns The absolute path to the config file
 */
export declare const getConfigPath: () => string;
/**
 * Check if config uses legacy password-based authentication
 * @param args - Configuration arguments
 * @param args.config - The config to check
 *
 * @returns True if the config has password but no refreshToken (needs migration)
 */
export declare const isLegacyPasswordConfig: (args: {
    config: Config;
}) => boolean;
/**
 * Get registry authentication for a specific registry URL
 * Uses unified Nori auth (config.auth) to derive registry credentials
 *
 * @param args - Configuration arguments
 * @param args.config - The config to search
 * @param args.registryUrl - The registry URL to find auth for
 *
 * @returns The matching RegistryAuth or null if not found
 */
export declare const getRegistryAuth: (args: {
    config: Config;
    registryUrl: string;
}) => RegistryAuth | null;
/**
 * Get the currently active skillset from config
 * @param args - Configuration arguments
 * @param args.config - The config to read
 *
 * @returns The active skillset name or null if not set
 */
export declare const getActiveSkillset: (args: {
    config: Config;
}) => string | null;
export declare const setGlobalAgentOverride: (agent: string | null) => void;
export declare const resetGlobalAgentOverride: () => void;
/**
 * Get all default agent names for CLI operations
 * Resolution order: explicit agentOverride > global agent override > config.defaultAgents > ["claude-code"]
 *
 * The global agent override is set once by the CLI preAction hook from the --agent flag,
 * so individual commands do not need to thread it through manually.
 *
 * @param args - Configuration arguments
 * @param args.config - The config to read defaultAgents from
 * @param args.agentOverride - Explicit agent name override: a string takes precedence over global,
 *   null suppresses the global override entirely, undefined falls through to global
 *
 * @returns Array of resolved agent names
 */
export declare const getDefaultAgents: (args: {
    config?: Config | null;
    agentOverride?: string | null;
}) => Array<string>;
/**
 * Load existing configuration from disk
 * Uses JSON schema validation for strict type checking.
 * Always reads from ~/.nori-config.json.
 *
 * @returns The config if valid, null otherwise
 */
export declare const loadConfig: () => Promise<Config | null>;
/**
 * Update configuration on disk using read-merge-write.
 * Loads existing config, merges caller-provided fields on top, and writes the result.
 * Fields not included in the update are preserved from the existing config.
 * Fields explicitly set to null are cleared.
 *
 * @param updates - Partial config fields to merge on top of existing config
 */
export declare const updateConfig: (updates: Partial<Config>) => Promise<void>;
/**
 * Validation result type
 */
export type ConfigValidationResult = {
    valid: boolean;
    message: string;
    errors?: Array<string> | null;
};
/**
 * Validate configuration file
 * Always validates ~/.nori-config.json
 *
 * @returns Validation result with details
 */
export declare const validateConfig: () => Promise<ConfigValidationResult>;
//# sourceMappingURL=config.d.ts.map