/**
 * Manifest-emitter — engines 6.29.0+.
 *
 * Deterministic replacement for the LLM-driven manifest call in the
 * analyse pipeline. The previous `runManifestCall` shipped detected
 * adapters + a stub `importsList` to an LLM and asked it to pattern-
 * match-and-lookup factory names — a job that doesn't need a model.
 * The LLM was unreliable (output had to be normalized for `specVersion`,
 * occasionally hallucinated factory names that don't exist), and one
 * more LLM call adds latency and cost without any decision quality the
 * source signals don't already give us.
 *
 * What `analyse` knows after prepass:
 *   - `meta.adaptersRun` — which detection adapters fired
 *   - `entities[].sourceFramework` — per-entity framework signal
 *   - `views[]` — presence of React/JSX
 *
 * What the realize engine needs:
 *   - A mapping from logical capability names (`api.rest`, `storage.X`,
 *     `ui.framework`, `auth.jwt`) to factory names from the engines
 *     instance-factory registry.
 *
 * The mapping IS a lookup table. This module IS that lookup table.
 *
 * V2 (engines 6.32.2+) — every emitted factory name MUST resolve in
 * the registered InstanceFactoryLibrary. The previous hand-curated
 * mapping referenced names that don't exist (`ExpressAPI`, `NestJSAPI`,
 * `MongoDBDriver`, `ReactRuntime`, `ReactNativeApp`) — realize then
 * left every model with `factory: unknown` and produced no code.
 *
 * Current mapping (registered factory names only — see
 * `libs/instance-factories/<category>/<name>.yaml`):
 *   - api.rest          → FastifyAPI                  (only HTTP factory shipped)
 *   - storage.database  → PostgreSQL15 | MongoDBNativeDriver
 *   - orm.schema/client → PrismaORM                   (when prisma signal present)
 *   - service.controller/business/crud → PrismaServices
 *   - app.frontend      → ReactAppRuntime             (no RN factory exists yet)
 *   - messaging.events  → EventEmitter
 *   - validation.runtime → ZodValidation
 *   - app.entrypoint    → GenericApp
 *   - project.scaffold  → GenericScaffold
 * Edge cases (drizzle, knex, vue, svelte, react-native, etc.) fall
 * through to the closest valid default and the user hand-edits.
 */
import type { SpecVerseFacts } from '../analyse-prepass/index.js';
import { RegistryClient } from '../registry/client/registry-client.js';
export interface ManifestEmissionInput {
    /** Specverse facts produced by the prepass. */
    facts: SpecVerseFacts;
    /**
     * Optional spec name for the `name:` field. Defaults to a generic
     * placeholder; callers (analyse-runner) typically pass the case name.
     */
    specName?: string;
    /**
     * Optional set of factory names advertised by the registry. AUGMENTS the
     * bundled `KNOWN_FACTORIES` validation set so an emitted choice may reference
     * a published (non-bundled) factory without being dropped. Defaults to none
     * (bundled-only — the always-available offline fallback). Populate via
     * `fetchRegistryFactoryNames` (analyse-runner does this opt-in).
     */
    registryFactories?: ReadonlySet<string>;
}
export interface ManifestEmissionResult {
    /** The emitted manifest yaml — a complete document including specVersion. */
    manifestYaml: string;
    /** Factory choice per capability — useful for telemetry/REPORT. */
    factoryChoices: Record<string, string>;
    /** Per-choice rationale: which signal drove the pick. Forward-logged. */
    rationale: Record<string, string>;
}
/**
 * Emit a deterministic manifest from prepass facts. The output is a
 * complete top-level YAML document (with specVersion) suitable for
 * writing to `manifests/implementation.yaml`.
 */
/**
 * Engines 6.32.2+ — registry of factory names actually present in the
 * shipped instance-factory library (`engines/libs/instance-factories/`).
 * Source: `find libs/instance-factories -name '*.yaml' | xargs grep '^name:'`.
 *
 * Manifest emission MUST pick from this set; emitting a non-existent
 * name leaves every realize-time model with `factory: unknown` and
 * produces no code. The previous emitter referenced ExpressAPI /
 * NestJSAPI / MongoDBDriver / ReactNativeApp / ReactRuntime — none of
 * which exist — and bored-stiff realize would silently emit nothing.
 *
 * Hand-edit consumers can still write any factory name they like in
 * the manifest; this guard only protects auto-emitted manifests from
 * the analyse pipeline.
 */
export declare const KNOWN_FACTORIES: ReadonlySet<string>;
export declare function emitManifest(input: ManifestEmissionInput): ManifestEmissionResult;
/**
 * Best-effort fetch of factory names advertised by the registry
 * (`GET /api/libraries?type=factory`, via the shared RegistryClient).
 *
 * Offline-safe: returns an EMPTY set on ANY failure (registry unreachable,
 * timeout, no factory records) and NEVER throws, so callers always fall back
 * to the bundled `KNOWN_FACTORIES`. Uses a short timeout + single attempt to
 * keep it cheap when offline.
 *
 * Intended use: analyse-runner passes the result as
 * `emitManifest({ ..., registryFactories })` (opt-in via
 * `SPECVERSE_REGISTRY_FACTORIES=1`) so published factories aren't dropped by
 * the bundled allow-list. The registry carries no factory records yet, so this
 * returns empty today — the wiring is ready for Phase 4 (factory libraries).
 */
export declare function fetchRegistryFactoryNames(client?: RegistryClient): Promise<Set<string>>;
//# sourceMappingURL=manifest-emitter.d.ts.map