Absolute path to the candidate embedding database.
Exact vault root allowed to own a populated file.
A discriminated, path-free discovery result. Only owned carries metadata.
If file does not end exactly in .embed.db; expected
discovery failures are fail-soft only after this pure namespace admission.
const discovery = await discoverEmbedDbConfig(embedFile, canonicalVaultRoot);
switch (discovery.kind) {
case "owned":
configureFrom(discovery.meta);
break;
case "missing":
case "empty":
configureFromRequest();
break;
case "refused":
throw new Error("Embedding index configuration could not be verified");
}
Discover whether an embedding database is missing, exactly schema-empty, fully owned by the expected vault, or refused. Existing files are opened through a read-only handle and inspected with the same bounded class/schema/root admission used by
EmbedDb.open(). Open, read, dependency, and close failures collapse torefused; this function does not throw expected discovery errors. SQLite/VFS lock, recovery, and WAL/SHM bookkeeping remain outside this logical guarantee. The complete main/WAL/ SHM/rollback-journal family is checked before dependency loading and again immediately before native open; unsafe, hardlinked, or orphaned leaves collapse torefusedunder the stable-parent boundary.This is a bounded pre-open configuration snapshot. Pass it to EmbedDb.open to bind the mutating open to that observed state; open independently repeats admission on its own live handle and again inside its immediate transaction.