@hasna/mementos 0.14.42 → 0.14.43

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/cli/index.js CHANGED
@@ -8416,9 +8416,11 @@ function isInMemoryDb(path) {
8416
8416
  }
8417
8417
  function findNearestMementosDb(startDir) {
8418
8418
  let dir = resolve(startDir);
8419
+ const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
8420
+ const legacyHomeDb = resolve(home, ".mementos", "mementos.db");
8419
8421
  while (true) {
8420
8422
  const candidate = join3(dir, ".mementos", "mementos.db");
8421
- if (existsSync3(candidate))
8423
+ if (existsSync3(candidate) && resolve(candidate) !== legacyHomeDb)
8422
8424
  return candidate;
8423
8425
  const parent = dirname(dir);
8424
8426
  if (parent === dir)
@@ -64428,6 +64430,9 @@ import { basename, dirname as dirname3, join as join5, resolve as resolve13 } fr
64428
64430
  function isInMemoryDb2(path) {
64429
64431
  return path === ":memory:" || path.startsWith("file::memory:");
64430
64432
  }
64433
+ function homeDir() {
64434
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir3();
64435
+ }
64431
64436
  var DEFAULT_CONFIG = {
64432
64437
  default_scope: "private",
64433
64438
  default_category: "knowledge",
@@ -64484,7 +64489,7 @@ function isValidCategory(value) {
64484
64489
  return VALID_CATEGORIES2.includes(value);
64485
64490
  }
64486
64491
  function loadConfig() {
64487
- const configPath = join5(homedir3(), ".hasna", "mementos", "config.json");
64492
+ const configPath = join5(homeDir(), ".hasna", "mementos", "config.json");
64488
64493
  let fileConfig = {};
64489
64494
  if (existsSync4(configPath)) {
64490
64495
  try {
@@ -64512,9 +64517,10 @@ function loadConfig() {
64512
64517
  }
64513
64518
  function findFileWalkingUp(filename) {
64514
64519
  let dir = process.cwd();
64520
+ const legacyHomeMementosDb = resolve13(homeDir(), ".mementos", "mementos.db");
64515
64521
  while (true) {
64516
64522
  const candidate = join5(dir, filename);
64517
- if (existsSync4(candidate)) {
64523
+ if (existsSync4(candidate) && resolve13(candidate) !== legacyHomeMementosDb) {
64518
64524
  return candidate;
64519
64525
  }
64520
64526
  const parent = dirname3(dir);
@@ -64538,10 +64544,10 @@ function findGitRoot2() {
64538
64544
  }
64539
64545
  }
64540
64546
  function profilesDir() {
64541
- return join5(homedir3(), ".hasna", "mementos", "profiles");
64547
+ return join5(homeDir(), ".hasna", "mementos", "profiles");
64542
64548
  }
64543
64549
  function globalConfigPath() {
64544
- return join5(homedir3(), ".hasna", "mementos", "config.json");
64550
+ return join5(homeDir(), ".hasna", "mementos", "config.json");
64545
64551
  }
64546
64552
  function readGlobalConfig() {
64547
64553
  const p = globalConfigPath();
@@ -64590,7 +64596,7 @@ function deleteProfile(name) {
64590
64596
  return true;
64591
64597
  }
64592
64598
  function getDbPath2() {
64593
- const _home = homedir3();
64599
+ const _home = homeDir();
64594
64600
  const _newDir = join5(_home, ".hasna", "mementos");
64595
64601
  const _oldDir = join5(_home, ".mementos");
64596
64602
  if (!existsSync4(_newDir) && existsSync4(_oldDir)) {
@@ -64625,7 +64631,7 @@ function getDbPath2() {
64625
64631
  if (found) {
64626
64632
  return found;
64627
64633
  }
64628
- const fallback = join5(homedir3(), ".hasna", "mementos", "mementos.db");
64634
+ const fallback = join5(homeDir(), ".hasna", "mementos", "mementos.db");
64629
64635
  ensureDir2(dirname3(fallback));
64630
64636
  return fallback;
64631
64637
  }
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AA+C1D,wBAAgB,SAAS,IAAI,MAAM,CAoBlC;AAiBD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAiCrD;AAgDD,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AASD,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAkBf"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAiD1D,wBAAgB,SAAS,IAAI,MAAM,CAoBlC;AAiBD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAiCrD;AAgDD,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AASD,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAkBf"}
package/dist/index.js CHANGED
@@ -6436,9 +6436,11 @@ function isInMemoryDb(path) {
6436
6436
  }
6437
6437
  function findNearestMementosDb(startDir) {
6438
6438
  let dir = resolve(startDir);
6439
+ const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
6440
+ const legacyHomeDb = resolve(home, ".mementos", "mementos.db");
6439
6441
  while (true) {
6440
6442
  const candidate = join2(dir, ".mementos", "mementos.db");
6441
- if (existsSync2(candidate))
6443
+ if (existsSync2(candidate) && resolve(candidate) !== legacyHomeDb)
6442
6444
  return candidate;
6443
6445
  const parent = dirname(dir);
6444
6446
  if (parent === dir)
@@ -55362,6 +55364,9 @@ import { basename, dirname as dirname2, join as join3, resolve as resolve2 } fro
55362
55364
  function isInMemoryDb2(path) {
55363
55365
  return path === ":memory:" || path.startsWith("file::memory:");
55364
55366
  }
55367
+ function homeDir() {
55368
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir2();
55369
+ }
55365
55370
  var DEFAULT_CONFIG = {
55366
55371
  default_scope: "private",
55367
55372
  default_category: "knowledge",
@@ -55418,7 +55423,7 @@ function isValidCategory(value) {
55418
55423
  return VALID_CATEGORIES.includes(value);
55419
55424
  }
55420
55425
  function loadConfig() {
55421
- const configPath = join3(homedir2(), ".hasna", "mementos", "config.json");
55426
+ const configPath = join3(homeDir(), ".hasna", "mementos", "config.json");
55422
55427
  let fileConfig = {};
55423
55428
  if (existsSync3(configPath)) {
55424
55429
  try {
@@ -55446,9 +55451,10 @@ function loadConfig() {
55446
55451
  }
55447
55452
  function findFileWalkingUp(filename) {
55448
55453
  let dir = process.cwd();
55454
+ const legacyHomeMementosDb = resolve2(homeDir(), ".mementos", "mementos.db");
55449
55455
  while (true) {
55450
55456
  const candidate = join3(dir, filename);
55451
- if (existsSync3(candidate)) {
55457
+ if (existsSync3(candidate) && resolve2(candidate) !== legacyHomeMementosDb) {
55452
55458
  return candidate;
55453
55459
  }
55454
55460
  const parent = dirname2(dir);
@@ -55472,10 +55478,10 @@ function findGitRoot2() {
55472
55478
  }
55473
55479
  }
55474
55480
  function profilesDir() {
55475
- return join3(homedir2(), ".hasna", "mementos", "profiles");
55481
+ return join3(homeDir(), ".hasna", "mementos", "profiles");
55476
55482
  }
55477
55483
  function globalConfigPath() {
55478
- return join3(homedir2(), ".hasna", "mementos", "config.json");
55484
+ return join3(homeDir(), ".hasna", "mementos", "config.json");
55479
55485
  }
55480
55486
  function readGlobalConfig() {
55481
55487
  const p = globalConfigPath();
@@ -55524,7 +55530,7 @@ function deleteProfile(name) {
55524
55530
  return true;
55525
55531
  }
55526
55532
  function getDbPath2() {
55527
- const _home = homedir2();
55533
+ const _home = homeDir();
55528
55534
  const _newDir = join3(_home, ".hasna", "mementos");
55529
55535
  const _oldDir = join3(_home, ".mementos");
55530
55536
  if (!existsSync3(_newDir) && existsSync3(_oldDir)) {
@@ -55559,7 +55565,7 @@ function getDbPath2() {
55559
55565
  if (found) {
55560
55566
  return found;
55561
55567
  }
55562
- const fallback = join3(homedir2(), ".hasna", "mementos", "mementos.db");
55568
+ const fallback = join3(homeDir(), ".hasna", "mementos", "mementos.db");
55563
55569
  ensureDir2(dirname2(fallback));
55564
55570
  return fallback;
55565
55571
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAU5E,eAAO,MAAM,cAAc,EAAE,cA4B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;AAwED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAMhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQ1D;AAED,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAOvC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAmDlC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAc5E,eAAO,MAAM,cAAc,EAAE,cA4B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;AA4ED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAMhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQ1D;AAED,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAOvC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAmDlC"}
package/dist/mcp/index.js CHANGED
@@ -6451,9 +6451,11 @@ function isInMemoryDb(path) {
6451
6451
  }
6452
6452
  function findNearestMementosDb(startDir) {
6453
6453
  let dir = resolve(startDir);
6454
+ const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
6455
+ const legacyHomeDb = resolve(home, ".mementos", "mementos.db");
6454
6456
  while (true) {
6455
6457
  const candidate = join2(dir, ".mementos", "mementos.db");
6456
- if (existsSync2(candidate))
6458
+ if (existsSync2(candidate) && resolve(candidate) !== legacyHomeDb)
6457
6459
  return candidate;
6458
6460
  const parent = dirname(dir);
6459
6461
  if (parent === dir)
@@ -14671,6 +14673,9 @@ import { basename as basename2, dirname as dirname4, join as join6, resolve as r
14671
14673
  function isInMemoryDb2(path) {
14672
14674
  return path === ":memory:" || path.startsWith("file::memory:");
14673
14675
  }
14676
+ function homeDir() {
14677
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir2();
14678
+ }
14674
14679
  function deepMerge(target, source) {
14675
14680
  const result = { ...target };
14676
14681
  for (const key of Object.keys(source)) {
@@ -14691,7 +14696,7 @@ function isValidCategory(value) {
14691
14696
  return VALID_CATEGORIES.includes(value);
14692
14697
  }
14693
14698
  function loadConfig() {
14694
- const configPath = join6(homedir2(), ".hasna", "mementos", "config.json");
14699
+ const configPath = join6(homeDir(), ".hasna", "mementos", "config.json");
14695
14700
  let fileConfig = {};
14696
14701
  if (existsSync6(configPath)) {
14697
14702
  try {
@@ -14719,9 +14724,10 @@ function loadConfig() {
14719
14724
  }
14720
14725
  function findFileWalkingUp(filename) {
14721
14726
  let dir = process.cwd();
14727
+ const legacyHomeMementosDb = resolve3(homeDir(), ".mementos", "mementos.db");
14722
14728
  while (true) {
14723
14729
  const candidate = join6(dir, filename);
14724
- if (existsSync6(candidate)) {
14730
+ if (existsSync6(candidate) && resolve3(candidate) !== legacyHomeMementosDb) {
14725
14731
  return candidate;
14726
14732
  }
14727
14733
  const parent = dirname4(dir);
@@ -14745,10 +14751,10 @@ function findGitRoot3() {
14745
14751
  }
14746
14752
  }
14747
14753
  function profilesDir() {
14748
- return join6(homedir2(), ".hasna", "mementos", "profiles");
14754
+ return join6(homeDir(), ".hasna", "mementos", "profiles");
14749
14755
  }
14750
14756
  function globalConfigPath() {
14751
- return join6(homedir2(), ".hasna", "mementos", "config.json");
14757
+ return join6(homeDir(), ".hasna", "mementos", "config.json");
14752
14758
  }
14753
14759
  function readGlobalConfig() {
14754
14760
  const p = globalConfigPath();
@@ -14768,7 +14774,7 @@ function getActiveProfile() {
14768
14774
  return cfg["active_profile"] || null;
14769
14775
  }
14770
14776
  function getDbPath2() {
14771
- const _home = homedir2();
14777
+ const _home = homeDir();
14772
14778
  const _newDir = join6(_home, ".hasna", "mementos");
14773
14779
  const _oldDir = join6(_home, ".mementos");
14774
14780
  if (!existsSync6(_newDir) && existsSync6(_oldDir)) {
@@ -14803,7 +14809,7 @@ function getDbPath2() {
14803
14809
  if (found) {
14804
14810
  return found;
14805
14811
  }
14806
- const fallback = join6(homedir2(), ".hasna", "mementos", "mementos.db");
14812
+ const fallback = join6(homeDir(), ".hasna", "mementos", "mementos.db");
14807
14813
  ensureDir2(dirname4(fallback));
14808
14814
  return fallback;
14809
14815
  }
@@ -5959,9 +5959,11 @@ function isInMemoryDb2(path) {
5959
5959
  }
5960
5960
  function findNearestMementosDb(startDir) {
5961
5961
  let dir = resolve2(startDir);
5962
+ const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
5963
+ const legacyHomeDb = resolve2(home, ".mementos", "mementos.db");
5962
5964
  while (true) {
5963
5965
  const candidate = join3(dir, ".mementos", "mementos.db");
5964
- if (existsSync2(candidate))
5966
+ if (existsSync2(candidate) && resolve2(candidate) !== legacyHomeDb)
5965
5967
  return candidate;
5966
5968
  const parent = dirname2(dir);
5967
5969
  if (parent === dir)
@@ -56000,11 +56002,15 @@ import { basename, dirname, join, resolve } from "path";
56000
56002
  function isInMemoryDb(path) {
56001
56003
  return path === ":memory:" || path.startsWith("file::memory:");
56002
56004
  }
56005
+ function homeDir() {
56006
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir();
56007
+ }
56003
56008
  function findFileWalkingUp(filename) {
56004
56009
  let dir = process.cwd();
56010
+ const legacyHomeMementosDb = resolve(homeDir(), ".mementos", "mementos.db");
56005
56011
  while (true) {
56006
56012
  const candidate = join(dir, filename);
56007
- if (existsSync(candidate)) {
56013
+ if (existsSync(candidate) && resolve(candidate) !== legacyHomeMementosDb) {
56008
56014
  return candidate;
56009
56015
  }
56010
56016
  const parent = dirname(dir);
@@ -56028,10 +56034,10 @@ function findGitRoot() {
56028
56034
  }
56029
56035
  }
56030
56036
  function profilesDir() {
56031
- return join(homedir(), ".hasna", "mementos", "profiles");
56037
+ return join(homeDir(), ".hasna", "mementos", "profiles");
56032
56038
  }
56033
56039
  function globalConfigPath() {
56034
- return join(homedir(), ".hasna", "mementos", "config.json");
56040
+ return join(homeDir(), ".hasna", "mementos", "config.json");
56035
56041
  }
56036
56042
  function readGlobalConfig() {
56037
56043
  const p = globalConfigPath();
@@ -56057,7 +56063,7 @@ function listProfiles() {
56057
56063
  return readdirSync(dir).filter((f) => f.endsWith(".db")).map((f) => basename(f, ".db")).sort();
56058
56064
  }
56059
56065
  function getDbPath() {
56060
- const _home = homedir();
56066
+ const _home = homeDir();
56061
56067
  const _newDir = join(_home, ".hasna", "mementos");
56062
56068
  const _oldDir = join(_home, ".mementos");
56063
56069
  if (!existsSync(_newDir) && existsSync(_oldDir)) {
@@ -56092,7 +56098,7 @@ function getDbPath() {
56092
56098
  if (found) {
56093
56099
  return found;
56094
56100
  }
56095
- const fallback = join(homedir(), ".hasna", "mementos", "mementos.db");
56101
+ const fallback = join(homeDir(), ".hasna", "mementos", "mementos.db");
56096
56102
  ensureDir(dirname(fallback));
56097
56103
  return fallback;
56098
56104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.14.42",
3
+ "version": "0.14.43",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",