import type { Logger, ProjectCandidate } from "@onenomad/przm-cortex-core"; import { type CortexConfig } from "../config.js"; /** * Runtime discovery services shared between the projects wizard and * adapter post-install hooks. Builds an adapter registry with stub * Engram/LLM — discovery only needs authentication and HTTP, not the * full daemon — then calls `discoverProjects` on each target adapter. */ export interface DiscoveredCandidate extends ProjectCandidate { sources?: Record; } export interface DiscoveryOptions { cfg: CortexConfig; repoRoot: string; logger: Logger; /** Limit discovery to these adapter ids. Omit to scan every enabled adapter. */ adapterIds?: readonly string[]; } export interface DiscoveryResult { candidates: DiscoveredCandidate[]; /** Per-adapter outcome so callers can render a summary. */ perAdapter: Array<{ adapterId: string; status: "ok" | "no-discovery" | "failed" | "not-enabled"; count?: number; error?: string; }>; } export declare function discoverProjectCandidates(opts: DiscoveryOptions): Promise; /** Merges candidates sharing a slug into one entry — exported for tests. */ export declare function dedupeBySlug(raw: readonly DiscoveredCandidate[]): DiscoveredCandidate[]; /** * Load `cortex.yaml` fresh for discovery — the post-install hook needs * the newly-merged adapter config, which only lands after * `applyWizardResult` writes to `cortex.local.yaml`. */ export declare function loadCurrentConfig(configPath: string): Promise; /** * Pre-install discovery: run `discoverProjects` on an adapter BEFORE * it's been merged into cortex.yaml. Used by the dashboard setup flow * so the user connects auth, then sees a multi-select of available * resources without first having to save a partial config. * * The adapter is instantiated with the provided config (whatever the * wizard has collected so far — for GitHub that's often empty, since * the token lives in the device-flow file). Adapters that validate * non-auth fields in init may reject this call; we surface that as * a "failed" status the UI can display. */ export declare function discoverForWizard(args: { wizardId: string; config: Record; secrets: Record; logger: Logger; repoRoot: string; }): Promise<{ candidates: DiscoveredCandidate[]; status: "ok" | "no-discovery" | "failed"; error?: string; }>; //# sourceMappingURL=discovery.d.ts.map