minimem 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -75,6 +75,7 @@ module.exports = __toCommonJS(index_exports);
75
75
  // src/minimem.ts
76
76
  var import_node_crypto2 = require("crypto");
77
77
  var import_promises2 = __toESM(require("fs/promises"), 1);
78
+ var import_node_fs3 = __toESM(require("fs"), 1);
78
79
  var import_node_path3 = __toESM(require("path"), 1);
79
80
  var import_node_sqlite = require("node:sqlite");
80
81
  var import_chokidar = __toESM(require("chokidar"), 1);
@@ -1914,6 +1915,14 @@ async function runGeminiEmbeddingBatches(params) {
1914
1915
  }
1915
1916
 
1916
1917
  // src/minimem.ts
1918
+ function resolveMinimemSubdir(memoryDir) {
1919
+ const envDir = process.env.MINIMEM_CONFIG_DIR;
1920
+ if (envDir) return envDir;
1921
+ if (import_node_fs3.default.existsSync(import_node_path3.default.join(memoryDir, "config.json"))) return ".";
1922
+ const swarmDir = import_node_path3.default.join(memoryDir, ".swarm", "minimem");
1923
+ if (import_node_fs3.default.existsSync(import_node_path3.default.join(swarmDir, "config.json"))) return import_node_path3.default.join(".swarm", "minimem");
1924
+ return ".minimem";
1925
+ }
1917
1926
  var META_KEY = "memory_index_meta_v1";
1918
1927
  var SNIPPET_MAX_CHARS = 700;
1919
1928
  var VECTOR_TABLE = "chunks_vec";
@@ -1953,7 +1962,7 @@ var Minimem = class _Minimem {
1953
1962
  embeddingOptions;
1954
1963
  constructor(config) {
1955
1964
  this.memoryDir = import_node_path3.default.resolve(config.memoryDir);
1956
- this.dbPath = config.dbPath ?? import_node_path3.default.join(this.memoryDir, ".minimem", "index.db");
1965
+ this.dbPath = config.dbPath ?? import_node_path3.default.join(this.memoryDir, resolveMinimemSubdir(this.memoryDir), "index.db");
1957
1966
  this.chunking = {
1958
1967
  tokens: config.chunking?.tokens ?? 256,
1959
1968
  overlap: config.chunking?.overlap ?? 32