/**
 * resolveInstance — the single entry point every lifecycle command uses to
 * decide which installed service it's operating on.
 *
 * Priority:
 *   1. --instance-dir <path>       → read manifest at <path>
 *   2. --name <name>               → match against listInstances() result
 *   3. CWD manifest                → read ./.kici-<component>.json
 *   4. otherwise                   → refuse with a candidate list (throws)
 *
 * listInstances reconciles the on-disk index (cache) with the driver's
 * native scan (source of truth). The reconciled result is rewritten back to
 * the index to self-heal stale entries.
 */
import type { DiscoveredInstance, ServiceManager } from '../types.js';
import type { Component, ResolveOptions, ResolvedInstance } from './types.js';
/** A reconciled view of a discovered instance: driver scan + (maybe) index entry. */
export interface ListedInstance extends DiscoveredInstance {
    instanceDir?: string;
    source: 'index' | 'scan' | 'index+scan';
}
export interface ListInstancesArgs {
    component: Component;
    isUserLevel: boolean;
    kiciRoot: string;
    manager: ServiceManager;
}
/**
 * Reconcile <kiciRoot>/instances.json with the driver's native scan, then
 * rewrite the index dropping entries whose units no longer exist. Returns
 * the merged list filtered to the requested component + isUserLevel.
 */
export declare function listInstances(args: ListInstancesArgs): Promise<ListedInstance[]>;
export interface ResolveArgs {
    component: Component;
    opts: ResolveOptions;
    cwd: string;
    kiciRoot: string;
    manager: ServiceManager;
    /**
     * Privilege scope to resolve against. Must match the caller's resolved
     * --system / --user-level decision so candidate lists and name lookups see
     * the correct set of installed instances.
     */
    isUserLevel: boolean;
}
/**
 * Resolve the target instance for the current lifecycle invocation.
 * Throws with a refusal/candidate-listing error when ambiguous.
 */
export declare function resolveInstance(args: ResolveArgs): Promise<ResolvedInstance>;
/**
 * Format the refusal message and candidate table.
 *
 * When candidates is empty, returns the "no instances installed" guidance.
 * When candidates exist, lists them with their instanceDir (or "(no manifest)").
 */
export declare function formatRefusal(component: Component, candidates: ListedInstance[]): string;
//# sourceMappingURL=resolve.d.ts.map