Skip to content

Local-first 🧠 memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.

TypeScript
1.2 KB
Raw Blame
/**
 * Sentinel embedding provider that surfaces configuration bugs.
 *
 * `embed()` throwing is intentional — a caller that reaches this path
 * has set semantic on the call but the runtime has no provider wired
 * up. Better to fail loud than to silently no-op and persist no
 * vectors.
 */

import { SearchError } from "../types.ts";
import type { EmbeddingProvider } from "./contract.ts";

export class NullProvider implements EmbeddingProvider {
  readonly name = "null";
  readonly model = "";
  readonly dimension = null;
  /**
   * The one implementation in the tree that embeds nothing, and the
   * reason the contract carries this flag at all
   * (provenance-at-the-boundary, F2). Callers ask
   * `providerProducesVectors(provider)`, never `provider.name === "null"`.
   */
  readonly producesVectors = false;

  embed(_texts: ReadonlyArray<string>): Promise<number[][]> {
    return Promise.reject(
      new SearchError(
        "EMBEDDING_DISABLED",
        "embeddings disabled: no provider configured. Set embedding_provider, embedding_base_url, embedding_model, embedding_api_key.",
      ),
    );
  }

  async ping(): Promise<{ ok: false; reason: string }> {
    return { ok: false, reason: "embeddings disabled" };
  }
}