dist / fileSearch / storageLocation.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.storageDirectory = storageDirectory;
exports.createDocumentStore = createDocumentStore;
const node_os_1 = require("node:os");
const node_path_1 = require("node:path");
const store_1 = require("./store");
function storageDirectory(env = process.env) {
const override = env.LMSTUDIO_FILE_SEARCH_DATA_DIR;
if (override !== undefined) {
if (!(0, node_path_1.isAbsolute)(override))
throw new Error("LMSTUDIO_FILE_SEARCH_DATA_DIR must be an absolute path.");
return override;
}
return (0, node_path_1.join)((0, node_os_1.homedir)(), ".lmstudio", "plugin-data", "yuanjumay", "file-search");
}
// Tool discovery and preprocessing do not always receive a working directory,
// and can receive different prediction controllers. Both must use the same
// persistent location, independent of controller and process working directory.
function createDocumentStore() {
return new store_1.DocumentStore(storageDirectory());
}