@datacore-one/mcp 1.5.1 → 1.5.2

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.js CHANGED
@@ -34,13 +34,33 @@ function detectStorage() {
34
34
  }
35
35
  return coreConfig(path.join(os.homedir(), "Datacore"));
36
36
  }
37
+ function discoverSpaces(basePath) {
38
+ const spaces = [];
39
+ try {
40
+ for (const entry of fs.readdirSync(basePath, { withFileTypes: true })) {
41
+ if (!entry.isDirectory() || !/^\d+-/.test(entry.name)) continue;
42
+ const spacePath = path.join(basePath, entry.name);
43
+ const name = entry.name.split("-").slice(1).join("-");
44
+ const notesJournals = path.join(spacePath, "notes", "journals");
45
+ const journal = path.join(spacePath, "journal");
46
+ const journalPath = fs.existsSync(notesJournals) ? notesJournals : journal;
47
+ const knowledgePath = path.join(spacePath, "3-knowledge");
48
+ spaces.push({ name, journalPath, knowledgePath });
49
+ }
50
+ } catch {
51
+ }
52
+ return spaces;
53
+ }
37
54
  function fullConfig(basePath) {
55
+ const spaces = discoverSpaces(basePath);
56
+ const primary = spaces.find((s) => s.name === "personal") ?? spaces[0];
38
57
  return {
39
58
  mode: "full",
40
59
  basePath,
41
60
  engramsPath: path.join(basePath, ".datacore", "learning", "engrams.yaml"),
42
- journalPath: path.join(basePath, "0-personal", "journal"),
43
- knowledgePath: path.join(basePath, "0-personal", "3-knowledge"),
61
+ journalPath: primary?.journalPath ?? path.join(basePath, "0-personal", "journal"),
62
+ knowledgePath: primary?.knowledgePath ?? path.join(basePath, "0-personal", "3-knowledge"),
63
+ spaces,
44
64
  packsPath: path.join(basePath, ".datacore", "learning", "packs"),
45
65
  schemasPath: path.join(basePath, ".datacore", "learning", "schemas.yaml"),
46
66
  exchangeInboxPath: path.join(basePath, ".datacore", "learning", "exchange", "inbox"),
@@ -57,6 +77,7 @@ function coreConfig(basePath) {
57
77
  engramsPath: path.join(basePath, "engrams.yaml"),
58
78
  journalPath: path.join(basePath, "journal"),
59
79
  knowledgePath: path.join(basePath, "knowledge"),
80
+ spaces: [{ name: "core", journalPath: path.join(basePath, "journal"), knowledgePath: path.join(basePath, "knowledge") }],
60
81
  packsPath: path.join(basePath, "packs"),
61
82
  schemasPath: path.join(basePath, "schemas.yaml"),
62
83
  exchangeInboxPath: path.join(basePath, "exchange", "inbox"),
@@ -279,7 +300,7 @@ function getConfig() {
279
300
  // package.json
280
301
  var package_default = {
281
302
  name: "@datacore-one/mcp",
282
- version: "1.5.1",
303
+ version: "1.5.2",
283
304
  description: "Datacore MCP server \u2014 The Software of You",
284
305
  type: "module",
285
306
  bin: {
@@ -1503,11 +1524,14 @@ async function keywordSearch(args2, paths) {
1503
1524
  const scope = args2.scope ?? "all";
1504
1525
  const limit = args2.limit ?? 20;
1505
1526
  const results = [];
1506
- if (scope === "journal" || scope === "all") {
1507
- results.push(...searchDir(paths.journalPath, args2.query));
1508
- }
1509
- if (scope === "knowledge" || scope === "all") {
1510
- results.push(...searchDir(paths.knowledgePath, args2.query));
1527
+ const spaces = paths.spaces ?? [{ name: "default", journalPath: paths.journalPath, knowledgePath: paths.knowledgePath }];
1528
+ for (const space of spaces) {
1529
+ if (scope === "journal" || scope === "all") {
1530
+ results.push(...searchDir(space.journalPath, args2.query));
1531
+ }
1532
+ if (scope === "knowledge" || scope === "all") {
1533
+ results.push(...searchDir(space.knowledgePath, args2.query));
1534
+ }
1511
1535
  }
1512
1536
  results.sort((a, b) => b.score - a.score);
1513
1537
  return { results: results.slice(0, limit), method: "keyword" };
@@ -3858,6 +3882,7 @@ async function handleRecall(args2, storage2, bridge) {
3858
3882
  const limit = args2.limit ?? 10;
3859
3883
  const result = {};
3860
3884
  let fallbackWarning;
3885
+ const searchPaths = { journalPath: storage2.journalPath, knowledgePath: storage2.knowledgePath, spaces: storage2.spaces };
3861
3886
  if (sources.includes("engrams")) {
3862
3887
  const engrams = loadEngrams(storage2.engramsPath);
3863
3888
  const topicWords = args2.topic.toLowerCase().split(/\s+/).filter((w) => w.length > 2);
@@ -3882,7 +3907,7 @@ async function handleRecall(args2, storage2, bridge) {
3882
3907
  if (sources.includes("journal")) {
3883
3908
  const searchResult = await handleSearch(
3884
3909
  { query: args2.topic, scope: "journal", limit },
3885
- { journalPath: storage2.journalPath, knowledgePath: storage2.knowledgePath },
3910
+ searchPaths,
3886
3911
  bridge
3887
3912
  );
3888
3913
  if (searchResult.results.length > 0) {
@@ -3901,7 +3926,7 @@ async function handleRecall(args2, storage2, bridge) {
3901
3926
  if (sources.includes("knowledge")) {
3902
3927
  const searchResult = await handleSearch(
3903
3928
  { query: args2.topic, scope: "knowledge", limit },
3904
- { journalPath: storage2.journalPath, knowledgePath: storage2.knowledgePath },
3929
+ searchPaths,
3905
3930
  bridge
3906
3931
  );
3907
3932
  if (searchResult.results.length > 0) {
@@ -5614,7 +5639,7 @@ async function routeTool(name, args2) {
5614
5639
  result = await handleInject(validated, { engramsPath: storage.engramsPath, packsPath: storage.packsPath, basePath: storage.basePath, schemasPath: storage.schemasPath });
5615
5640
  break;
5616
5641
  case "datacore.search":
5617
- result = await handleSearch(validated, { journalPath: storage.journalPath, knowledgePath: storage.knowledgePath }, datacortexBridge);
5642
+ result = await handleSearch(validated, { journalPath: storage.journalPath, knowledgePath: storage.knowledgePath, spaces: storage.spaces }, datacortexBridge);
5618
5643
  break;
5619
5644
  case "datacore.ingest":
5620
5645
  result = await handleIngest(validated, { knowledgePath: storage.knowledgePath, engramsPath: storage.engramsPath });
@@ -5635,7 +5660,7 @@ async function routeTool(name, args2) {
5635
5660
  result = await handleSessionEnd(validated, storage, getEngagementService(), sessionTracker);
5636
5661
  break;
5637
5662
  case "datacore.recall":
5638
- result = await handleRecall(validated, { engramsPath: storage.engramsPath, journalPath: storage.journalPath, knowledgePath: storage.knowledgePath }, datacortexBridge);
5663
+ result = await handleRecall(validated, { engramsPath: storage.engramsPath, journalPath: storage.journalPath, knowledgePath: storage.knowledgePath, spaces: storage.spaces }, datacortexBridge);
5639
5664
  break;
5640
5665
  case "datacore.promote":
5641
5666
  result = await handlePromote(validated, storage.engramsPath, getEngagementService());