socraticode
Version:
SocratiCode — MCP server for local codebase indexing, semantic search, and code dependency graphs. All private, all local via Docker.
60 lines • 3.14 kB
TypeScript
/**
* Version of the installed @qdrant/js-client-rest, or null when it cannot
* be determined.
*
* The package's `exports` map exposes only `.`, so
* `require("@qdrant/js-client-rest/package.json")` throws
* ERR_PACKAGE_PATH_NOT_EXPORTED; instead the entry file is resolved and the
* walk goes upward to the nearest package.json that declares the package's
* own name (the entry sits inside dist/, whose parent directories may hold
* unrelated package.json files, hence the name check).
*/
export declare function readInstalledQdrantClientVersion(): string | null;
/**
* Whether the (node major, installed client version) pair is the one that
* breaks: Node 26+ with a client older than 1.19.
*
* An undeterminable version on Node 26+ refuses too (returns true): the
* alternative is booting into a possibly-broken client whose first request
* dies with an opaque undici error, which is exactly what the guard exists
* to prevent. On Node < 26 the client version is irrelevant.
*/
export type QdrantFetchMode = "native" | "paired-undici" | "unknown";
/**
* Probe whether the built-in fetch can hand a request to an undici 6
* dispatcher.
*
* undici 6's `DispatcherBase.dispatch` catches a throw from the wrapped
* dispatcher and then calls `handler.onError(err)`. Node's built-in fetch
* passes a handler without that method, so the recovery path itself throws
* `InvalidArgumentError: invalid onError method` and the caller only sees
* `TypeError: fetch failed`.
*
* The probe hands fetch a stub dispatcher, records the handler shape it
* receives, and rejects the synthetic request without a network round trip.
* Returns true when built-in fetch supplied an `onError` method (i.e. the pair
* is safe).
*/
export declare function nativeFetchSupportsUndiciDispatcher(nativeFetch?: FetchFunction): boolean;
/** Select the fetch transport required by a Node/Qdrant-client pair. */
export declare function qdrantFetchMode(nodeMajor: number, clientVersion: string | null): QdrantFetchMode;
type FetchFunction = typeof globalThis.fetch;
/**
* Build a fetch wrapper that pairs Qdrant's undici dispatcher with undici's
* own fetch. Errors propagate unchanged; there is no retry or fallback path.
*/
export declare function createQdrantFetchBridge(nativeFetch: FetchFunction, pairedFetch: FetchFunction, qdrantOrigins: ReadonlySet<string>): FetchFunction;
/**
* Install the Qdrant transport bridge once for the configured Qdrant origin.
* Repeated calls only register an additional origin.
*
* The capability probe is consulted first and is authoritative: a runtime
* whose built-in fetch cannot hand a request to the client's undici dispatcher
* needs the bridge whatever its Node version or distribution, and a runtime
* that can needs the native transport. The version table stays as the fallback
* for the (undetectable-probe) case, and the `unknown` mode still refuses
* rather than booting into a client whose first request would die opaquely.
*/
export declare function ensureQdrantClientCompatibility(qdrantBaseUrl: string): void;
export {};
//# sourceMappingURL=qdrant-client-compat.d.ts.map