Files
openclaw/packages/memory-host-sdk/src/host/sqlite-vec-platform-variant.ts
Peter Steinberger 4f4d108639 chore(lint): remove underscore-dangle allow list (#83542)
* chore(lint): reduce underscore-dangle exceptions

* chore(lint): reduce more underscore exceptions

* chore(lint): remove underscore-dangle allow list

* fix(lint): repair underscore cleanup regressions

* test(lint): track version define suppression
2026-05-18 14:56:06 +01:00

28 lines
1017 B
TypeScript

import { createRequire } from "node:module";
type PlatformVariant = { readonly pkg: string; readonly file: string };
const PLATFORM_VARIANTS: Readonly<Record<string, PlatformVariant | undefined>> = {
"linux-x64": { pkg: "sqlite-vec-linux-x64", file: "vec0.so" },
"linux-arm64": { pkg: "sqlite-vec-linux-arm64", file: "vec0.so" },
"darwin-x64": { pkg: "sqlite-vec-darwin-x64", file: "vec0.dylib" },
"darwin-arm64": { pkg: "sqlite-vec-darwin-arm64", file: "vec0.dylib" },
"win32-x64": { pkg: "sqlite-vec-windows-x64", file: "vec0.dll" },
};
export function resolveSqliteVecPlatformVariant():
| { pkg: string; extensionPath: string }
| undefined {
const entry = PLATFORM_VARIANTS[`${process.platform}-${process.arch}`];
if (!entry) {
return undefined;
}
try {
const requireForResolve = createRequire(import.meta.url);
const extensionPath = requireForResolve.resolve(`${entry.pkg}/${entry.file}`);
return { pkg: entry.pkg, extensionPath };
} catch {
return undefined;
}
}