@vheins/local-memory-mcp 0.18.9 → 0.18.10

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.
@@ -81,8 +81,8 @@ function loadServerInstructions() {
81
81
  // src/mcp/capabilities.ts
82
82
  var __dirname2 = path2.dirname(fileURLToPath2(import.meta.url));
83
83
  var pkgVersion = "0.1.0";
84
- if ("0.18.9") {
85
- pkgVersion = "0.18.9";
84
+ if ("0.18.10") {
85
+ pkgVersion = "0.18.10";
86
86
  } else {
87
87
  let searchDir = __dirname2;
88
88
  for (let i = 0; i < 5; i++) {
@@ -1319,8 +1319,14 @@ var MemoryEntity = class extends BaseEntity {
1319
1319
  const row = this.get("SELECT * FROM memories WHERE id = ?", [id]);
1320
1320
  return row ? this.rowToMemoryEntry(row) : null;
1321
1321
  }
1322
- getByCode(code) {
1323
- const row = this.get("SELECT * FROM memories WHERE code = ?", [code]);
1322
+ getByCode(code, owner, repo) {
1323
+ let sql = "SELECT * FROM memories WHERE code = ?";
1324
+ const params = [code];
1325
+ if (owner && repo) {
1326
+ sql += " AND owner = ? AND repo = ?";
1327
+ params.push(owner, repo);
1328
+ }
1329
+ const row = this.get(sql, params);
1324
1330
  return row ? this.rowToMemoryEntry(row) : null;
1325
1331
  }
1326
1332
  getByIdWithStats(id) {
@@ -2757,8 +2763,14 @@ var StandardEntity = class extends BaseEntity {
2757
2763
  const row = this.get("SELECT * FROM coding_standards WHERE id = ?", [id]);
2758
2764
  return row ? this.rowToEntry(row) : null;
2759
2765
  }
2760
- getByCode(code) {
2761
- const row = this.get("SELECT * FROM coding_standards WHERE code = ?", [code]);
2766
+ getByCode(code, owner, repo) {
2767
+ let sql = "SELECT * FROM coding_standards WHERE code = ?";
2768
+ const params = [code];
2769
+ if (owner && repo) {
2770
+ sql += " AND owner = ? AND repo = ?";
2771
+ params.push(owner, repo);
2772
+ }
2773
+ const row = this.get(sql, params);
2762
2774
  return row ? this.rowToEntry(row) : null;
2763
2775
  }
2764
2776
  search(options) {
@@ -3646,6 +3658,8 @@ var MemoryStoreSchema = z.object({
3646
3658
  var MemoryUpdateSchema = z.object({
3647
3659
  id: z.string().uuid().optional(),
3648
3660
  code: z.string().max(20).optional(),
3661
+ owner: z.string().min(1),
3662
+ repo: z.string().min(1).transform(normalizeRepo),
3649
3663
  type: MemoryTypeSchema.optional(),
3650
3664
  title: z.string().min(3).max(255).optional(),
3651
3665
  content: z.string().min(10).optional(),
@@ -3684,6 +3698,8 @@ var MemorySearchSchema = z.object({
3684
3698
  var MemoryAcknowledgeSchema = z.object({
3685
3699
  memory_id: z.string().uuid().optional(),
3686
3700
  code: z.string().max(20).optional(),
3701
+ owner: z.string().min(1),
3702
+ repo: z.string().min(1).transform(normalizeRepo),
3687
3703
  status: z.enum(["used", "irrelevant", "contradictory"]),
3688
3704
  application_context: z.string().min(10).optional(),
3689
3705
  structured: z.boolean().default(false)
@@ -3698,8 +3714,8 @@ var MemoryRecapSchema = z.object({
3698
3714
  structured: z.boolean().default(false)
3699
3715
  });
3700
3716
  var MemoryDeleteSchema = z.object({
3701
- owner: z.string().optional().default(""),
3702
- repo: z.string().min(1).transform(normalizeRepo).optional(),
3717
+ owner: z.string().min(1),
3718
+ repo: z.string().min(1).transform(normalizeRepo),
3703
3719
  id: z.string().uuid().optional(),
3704
3720
  ids: z.array(z.string().uuid()).min(1).optional(),
3705
3721
  code: z.string().max(20).optional(),
@@ -3902,6 +3918,8 @@ var TaskDeleteSchema = z.object({
3902
3918
  var MemoryDetailSchema = z.object({
3903
3919
  id: z.string().uuid().optional(),
3904
3920
  code: z.string().max(20).optional(),
3921
+ owner: z.string().min(1),
3922
+ repo: z.string().min(1).transform(normalizeRepo),
3905
3923
  structured: z.boolean().default(false)
3906
3924
  }).refine((data) => data.id !== void 0 || data.code !== void 0, {
3907
3925
  message: "Either id or code must be provided"
@@ -3909,13 +3927,15 @@ var MemoryDetailSchema = z.object({
3909
3927
  var StandardDetailSchema = z.object({
3910
3928
  id: z.string().uuid().optional(),
3911
3929
  code: z.string().max(20).optional(),
3930
+ owner: z.string().min(1),
3931
+ repo: z.string().min(1).transform(normalizeRepo),
3912
3932
  structured: z.boolean().default(false)
3913
3933
  }).refine((data) => data.id !== void 0 || data.code !== void 0, {
3914
3934
  message: "Either id or code must be provided"
3915
3935
  });
3916
3936
  var StandardDeleteSchema = z.object({
3917
- owner: z.string().optional().default(""),
3918
- repo: z.string().min(1).transform(normalizeRepo).optional(),
3937
+ owner: z.string().min(1),
3938
+ repo: z.string().min(1).transform(normalizeRepo),
3919
3939
  id: z.string().uuid().optional(),
3920
3940
  ids: z.array(z.string().uuid()).min(1).optional(),
3921
3941
  code: z.string().max(20).optional(),
@@ -4042,8 +4062,8 @@ var StandardUpdateSchema = z.object({
4042
4062
  version: z.string().optional(),
4043
4063
  language: z.string().optional(),
4044
4064
  stack: z.array(z.string().min(1)).min(1).optional(),
4045
- owner: z.string().optional().default(""),
4046
- repo: z.string().transform(normalizeRepo).optional(),
4065
+ owner: z.string().min(1),
4066
+ repo: z.string().transform(normalizeRepo),
4047
4067
  is_global: z.boolean().optional(),
4048
4068
  tags: z.array(z.string().min(1)).min(1).optional(),
4049
4069
  metadata: z.record(z.string(), z.any()).refine((value) => Object.keys(value).length > 0, { message: "metadata must contain at least one key" }).optional(),
@@ -16,7 +16,7 @@ import {
16
16
  handleTaskClaim,
17
17
  listResources,
18
18
  logger
19
- } from "../chunk-XZHWHX2U.js";
19
+ } from "../chunk-YACQ3MHF.js";
20
20
 
21
21
  // src/dashboard/server.ts
22
22
  import express from "express";
@@ -63,7 +63,7 @@ import {
63
63
  toContextSlug,
64
64
  updateSessionFromInitialize,
65
65
  updateSessionRoots
66
- } from "../chunk-XZHWHX2U.js";
66
+ } from "../chunk-YACQ3MHF.js";
67
67
 
68
68
  // src/mcp/server.ts
69
69
  import readline from "readline";
@@ -230,10 +230,10 @@ function hasMetadataLikeTitle(title) {
230
230
  const normalized = title.trim();
231
231
  return /^\[[^\]]{0,200}(agent:|role:|model:|\d{4}-\d{2}-\d{2}|source_)[^\]]*\]/i.test(normalized);
232
232
  }
233
- function resolveMemorySupersedes(value, db2) {
233
+ function resolveMemorySupersedes(value, db2, owner, repo) {
234
234
  if (!value) return null;
235
235
  if (UUID_REGEX.test(value)) return value;
236
- const memory = db2.memories.getByCode(value);
236
+ const memory = db2.memories.getByCode(value, owner, repo);
237
237
  if (!memory) throw new Error(`supersedes: memory with code '${value}' not found`);
238
238
  return memory.id;
239
239
  }
@@ -246,7 +246,7 @@ async function storeSingleMemory(params, db2, vectors2) {
246
246
  const now = (/* @__PURE__ */ new Date()).toISOString();
247
247
  const createdAtTime = new Date(now).getTime();
248
248
  const expires_at = params.ttlDays != null ? new Date(createdAtTime + params.ttlDays * 864e5).toISOString() : null;
249
- const resolvedSupersedes = resolveMemorySupersedes(params.supersedes, db2);
249
+ const resolvedSupersedes = resolveMemorySupersedes(params.supersedes, db2, params.scope.owner, params.scope.repo);
250
250
  if (!resolvedSupersedes && params.type !== "task_archive") {
251
251
  const conflict = await db2.memoryVectors.checkConflicts(
252
252
  params.content,
@@ -341,7 +341,7 @@ async function handleMemoryStore(params, db2, vectors2) {
341
341
  }
342
342
  const createdAtTime = new Date(now).getTime();
343
343
  const expires_at = mem.ttlDays != null ? new Date(createdAtTime + mem.ttlDays * 864e5).toISOString() : null;
344
- const resolvedSupersedes = resolveMemorySupersedes(mem.supersedes, db2);
344
+ const resolvedSupersedes = resolveMemorySupersedes(mem.supersedes, db2, mem.scope.owner, mem.scope.repo);
345
345
  if (!resolvedSupersedes && mem.type !== "task_archive") {
346
346
  const conflict = await db2.memoryVectors.checkConflicts(
347
347
  mem.content,
@@ -451,10 +451,10 @@ function hasMetadataLikeTitle2(title) {
451
451
  const normalized = title.trim();
452
452
  return /^\[[^\]]{0,200}(agent:|role:|model:|\d{4}-\d{2}-\d{2}|source_)[^\]]*\]/i.test(normalized);
453
453
  }
454
- function resolveMemorySupersedes2(value, db2) {
454
+ function resolveMemorySupersedes2(value, db2, owner, repo) {
455
455
  if (!value) return null;
456
456
  if (UUID_REGEX2.test(value)) return value;
457
- const memory = db2.memories.getByCode(value);
457
+ const memory = db2.memories.getByCode(value, owner, repo);
458
458
  if (!memory) throw new Error(`supersedes: memory with code '${value}' not found`);
459
459
  return memory.id;
460
460
  }
@@ -462,7 +462,7 @@ async function handleMemoryUpdate(params, db2, vectors2) {
462
462
  const validated = MemoryUpdateSchema.parse(params);
463
463
  let resolvedId = validated.id;
464
464
  if (!resolvedId && validated.code) {
465
- const byCode = db2.memories.getByCode(validated.code);
465
+ const byCode = db2.memories.getByCode(validated.code, validated.owner, validated.repo);
466
466
  if (!byCode) throw new Error(`Memory not found: ${validated.code}`);
467
467
  resolvedId = byCode.id;
468
468
  } else if (!resolvedId) {
@@ -491,7 +491,8 @@ async function handleMemoryUpdate(params, db2, vectors2) {
491
491
  if (validated.agent !== void 0) updates.agent = validated.agent;
492
492
  if (validated.role !== void 0) updates.role = validated.role;
493
493
  if (validated.status !== void 0) updates.status = validated.status;
494
- if (validated.supersedes !== void 0) updates.supersedes = resolveMemorySupersedes2(validated.supersedes, db2);
494
+ if (validated.supersedes !== void 0)
495
+ updates.supersedes = resolveMemorySupersedes2(validated.supersedes, db2, existing.scope.owner, existing.scope.repo);
495
496
  if (validated.tags !== void 0) updates.tags = validated.tags;
496
497
  if (validated.metadata !== void 0) updates.metadata = validated.metadata;
497
498
  if (validated.is_global !== void 0) updates.is_global = validated.is_global;
@@ -1676,18 +1677,18 @@ async function executeSamplingTool(toolName, rawInput, db2, vectors2, owner) {
1676
1677
  // src/mcp/tools/memory.delete.ts
1677
1678
  async function handleMemoryDelete(params, db2, vectors2, onProgress) {
1678
1679
  const validated = MemoryDeleteSchema.parse(params);
1679
- const { id, ids, code, codes, repo, structured } = validated;
1680
+ const { id, ids, code, codes, owner, repo, structured } = validated;
1680
1681
  const resolvedIds = [];
1681
1682
  if (ids) resolvedIds.push(...ids);
1682
1683
  if (id) resolvedIds.push(id);
1683
1684
  if (code) {
1684
- const entry = db2.memories.getByCode(code);
1685
+ const entry = db2.memories.getByCode(code, owner, repo);
1685
1686
  if (!entry) throw new Error(`Memory not found: ${code}`);
1686
1687
  resolvedIds.push(entry.id);
1687
1688
  }
1688
1689
  if (codes) {
1689
1690
  for (const c of codes) {
1690
- const entry = db2.memories.getByCode(c);
1691
+ const entry = db2.memories.getByCode(c, owner, repo);
1691
1692
  if (!entry) throw new Error(`Memory not found: ${c}`);
1692
1693
  resolvedIds.push(entry.id);
1693
1694
  }
@@ -1751,7 +1752,7 @@ async function handleMemoryAcknowledge(params, db2) {
1751
1752
  const validated = MemoryAcknowledgeSchema.parse(params);
1752
1753
  let memoryId = validated.memory_id;
1753
1754
  if (!memoryId && validated.code) {
1754
- const byCode = db2.memories.getByCode(validated.code);
1755
+ const byCode = db2.memories.getByCode(validated.code, validated.owner, validated.repo);
1755
1756
  if (!byCode) throw new Error(`Memory not found: ${validated.code}`);
1756
1757
  memoryId = byCode.id;
1757
1758
  } else if (!memoryId) {
@@ -1789,12 +1790,12 @@ async function handleMemoryAcknowledge(params, db2) {
1789
1790
  // src/mcp/tools/memory.detail.ts
1790
1791
  async function handleMemoryDetail(args, storage) {
1791
1792
  const validated = MemoryDetailSchema.parse(args);
1792
- const { id, code } = validated;
1793
+ const { id, code, owner, repo } = validated;
1793
1794
  let memory;
1794
1795
  if (id) {
1795
1796
  memory = storage.memories.getById(id);
1796
1797
  } else if (code) {
1797
- memory = storage.memories.getByCode(code);
1798
+ memory = storage.memories.getByCode(code, owner, repo);
1798
1799
  }
1799
1800
  if (!memory) {
1800
1801
  throw new Error(`Memory not found: ${id || code}`);
@@ -1823,10 +1824,10 @@ async function handleMemoryDetail(args, storage) {
1823
1824
  // src/mcp/tools/standard.store.ts
1824
1825
  import { randomUUID as randomUUID3 } from "crypto";
1825
1826
  var UUID_REGEX4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1826
- function resolveStandardParentId(value, db2) {
1827
+ function resolveStandardParentId(value, db2, owner, repo) {
1827
1828
  if (!value) return null;
1828
1829
  if (UUID_REGEX4.test(value)) return value;
1829
- const standard = db2.standards.getByCode(value);
1830
+ const standard = db2.standards.getByCode(value, owner, repo);
1830
1831
  if (!standard) throw new Error(`parent_id: standard with code '${value}' not found`);
1831
1832
  return standard.id;
1832
1833
  }
@@ -1868,7 +1869,7 @@ async function storeSingleStandard(params, db2, vectors2) {
1868
1869
  code: generateNextCode(params.owner, params.repo || "__global__", "standard", db2),
1869
1870
  title: params.name,
1870
1871
  content: params.content,
1871
- parent_id: resolveStandardParentId(params.parent_id, db2),
1872
+ parent_id: resolveStandardParentId(params.parent_id, db2, params.owner, params.repo),
1872
1873
  context: toContextSlug(params.context || "general"),
1873
1874
  version: params.version || "1.0.0",
1874
1875
  language: params.language || null,
@@ -1951,7 +1952,7 @@ async function handleStandardStore(params, db2, vectors2) {
1951
1952
  code,
1952
1953
  title: std.name,
1953
1954
  content: std.content,
1954
- parent_id: resolveStandardParentId(std.parent_id, db2),
1955
+ parent_id: resolveStandardParentId(std.parent_id, db2, validated.owner, validated.repo),
1955
1956
  context: toContextSlug(std.context || "general"),
1956
1957
  version: std.version || "1.0.0",
1957
1958
  language: std.language || null,
@@ -2233,10 +2234,10 @@ async function handleStandardSearch(params, db2, vectors2) {
2233
2234
 
2234
2235
  // src/mcp/tools/standard.update.ts
2235
2236
  var UUID_REGEX5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2236
- function resolveStandardParentId2(value, db2) {
2237
+ function resolveStandardParentId2(value, db2, owner, repo) {
2237
2238
  if (!value) return null;
2238
2239
  if (UUID_REGEX5.test(value)) return value;
2239
- const standard = db2.standards.getByCode(value);
2240
+ const standard = db2.standards.getByCode(value, owner, repo);
2240
2241
  if (!standard) throw new Error(`parent_id: standard with code '${value}' not found`);
2241
2242
  return standard.id;
2242
2243
  }
@@ -2244,7 +2245,7 @@ async function handleStandardUpdate(params, db2, vectors2) {
2244
2245
  const validated = StandardUpdateSchema.parse(params);
2245
2246
  let resolvedId = validated.id;
2246
2247
  if (!resolvedId && validated.code) {
2247
- const byCode = db2.standards.getByCode(validated.code);
2248
+ const byCode = db2.standards.getByCode(validated.code, validated.owner, validated.repo);
2248
2249
  if (!byCode) throw new Error(`Coding standard not found: ${validated.code}`);
2249
2250
  resolvedId = byCode.id;
2250
2251
  } else if (!resolvedId) {
@@ -2257,7 +2258,8 @@ async function handleStandardUpdate(params, db2, vectors2) {
2257
2258
  const updates = {};
2258
2259
  if (validated.name !== void 0) updates.title = validated.name;
2259
2260
  if (validated.content !== void 0) updates.content = validated.content;
2260
- if (validated.parent_id !== void 0) updates.parent_id = resolveStandardParentId2(validated.parent_id, db2);
2261
+ if (validated.parent_id !== void 0)
2262
+ updates.parent_id = resolveStandardParentId2(validated.parent_id, db2, existing.owner, existing.repo ?? void 0);
2261
2263
  if (validated.context !== void 0) updates.context = validated.context;
2262
2264
  if (validated.version !== void 0) updates.version = validated.version;
2263
2265
  if (validated.language !== void 0) updates.language = validated.language;
@@ -2299,7 +2301,7 @@ async function handleStandardUpdate(params, db2, vectors2) {
2299
2301
  // src/mcp/tools/standard.detail.ts
2300
2302
  async function handleStandardDetail(args, storage) {
2301
2303
  const validated = StandardDetailSchema.parse(args);
2302
- const standard = validated.id ? storage.standards.getById(validated.id) : storage.standards.getByCode(validated.code);
2304
+ const standard = validated.id ? storage.standards.getById(validated.id) : storage.standards.getByCode(validated.code, validated.owner, validated.repo);
2303
2305
  if (!standard) {
2304
2306
  const identifier = validated.id ?? validated.code;
2305
2307
  throw new Error(`Coding standard not found: ${identifier}`);
@@ -2333,18 +2335,18 @@ async function handleStandardDetail(args, storage) {
2333
2335
  // src/mcp/tools/standard.delete.ts
2334
2336
  async function handleStandardDelete(params, db2, vectors2) {
2335
2337
  const validated = StandardDeleteSchema.parse(params);
2336
- const { id, ids, code, codes, repo, structured } = validated;
2338
+ const { id, ids, code, codes, owner, repo, structured } = validated;
2337
2339
  const resolvedIds = [];
2338
2340
  if (ids) resolvedIds.push(...ids);
2339
2341
  if (id) resolvedIds.push(id);
2340
2342
  if (code) {
2341
- const entry = db2.standards.getByCode(code);
2343
+ const entry = db2.standards.getByCode(code, owner, repo);
2342
2344
  if (!entry) throw new Error(`Coding standard not found: ${code}`);
2343
2345
  resolvedIds.push(entry.id);
2344
2346
  }
2345
2347
  if (codes) {
2346
2348
  for (const c of codes) {
2347
- const entry = db2.standards.getByCode(c);
2349
+ const entry = db2.standards.getByCode(c, owner, repo);
2348
2350
  if (!entry) throw new Error(`Coding standard not found: ${c}`);
2349
2351
  resolvedIds.push(entry.id);
2350
2352
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vheins/local-memory-mcp",
3
- "version": "0.18.9",
3
+ "version": "0.18.10",
4
4
  "description": "MCP Local Memory Service for coding copilot agents",
5
5
  "mcpName": "io.github.vheins/local-memory-mcp",
6
6
  "type": "module",