/** * Convenience: build the optional EnhancedFactStore + knowledge-graph worker * config from the canonical `HORIZON_*` environment variables. * * The `PilotSwarmWorker` intentionally does NOT read `process.env` itself — app * entrypoints own env parsing and pass explicit config. This helper exists so the * shipped CLI/portal embedded worker, the standalone K8s worker, and the examples * all map the same env vars to the same worker fields, with no drift. * * Returns an EMPTY object when none of the `HORIZON_*` vars are set (the default — * plain `PgFactStore`, no enhanced provider, no graph). The enhanced facts store and * the knowledge graph are INDEPENDENT axes: setting only `HORIZON_GRAPH_DATABASE_URL` * yields a graph over the base fact store (graph tools, no search). Spread the result * into the worker options: * * ```ts * const worker = new PilotSwarmWorker({ * store: process.env.DATABASE_URL, * githubToken: process.env.GITHUB_TOKEN, * ...horizonConfigFromEnv(), * }); * ``` * * Env vars (all optional except the database URL): * HORIZON_DATABASE_URL → enhancedFactsDatabaseUrl (enables the enhanced * provider; worker infers factsProvider="horizon") * HORIZON_FACTS_SCHEMA → enhancedFactsSchema (default "horizon_facts") * HORIZON_GRAPH_DATABASE_URL → graphDatabaseUrl (opt-in graph; unset ⇒ no graph) * HORIZON_GRAPH_SCHEMA → graphSchema (default "horizon_graph") * HORIZON_GRAPH_REGISTRY_SCHEMA → graphRegistrySchema (default * `${graphSchema}_registry`; MUST differ from graphSchema) * HORIZON_NAMESPACE_CACHE_TTL_MS → graphNamespaceCacheTtlMs (default 60000; 0 disables cache) * HORIZON_EMBED_URL/MODEL/DIM → horizonEmbed (durable embedder; all three * required, else the embedder is omitted and * search runs lexical-only) * HORIZON_EMBED_API_KEY → horizonEmbed.apiKey * HORIZON_EMBED_API_KEY_HEADER→ horizonEmbed.apiKeyHeader (default "api-key") * HORIZON_EMBED_BEARER → horizonEmbed.bearer (sends "Bearer "); * inferred true when the header is "Authorization" * * @module */ import type { EmbeddingEndpointConfig } from "./facts-store.js"; /** The subset of `PilotSwarmWorkerOptions` that the `HORIZON_*` env vars map to. */ export interface HorizonEnvConfig { enhancedFactsDatabaseUrl?: string; enhancedFactsSchema?: string; horizonEmbed?: EmbeddingEndpointConfig; graphDatabaseUrl?: string; graphSchema?: string; graphRegistrySchema?: string; graphNamespaceCacheTtlMs?: number; } /** * Map the `HORIZON_*` environment variables to the worker's enhanced-facts / * knowledge-graph config. Pure and side-effect-free; safe to call at startup. * * @param env - Environment source (defaults to `process.env`). */ export declare function horizonConfigFromEnv(env?: Record): HorizonEnvConfig; //# sourceMappingURL=horizon-env.d.ts.map