@modusensus/dsh-mneme 0.7.5 → 0.7.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.
@@ -302,7 +302,7 @@ export function createTools(ctx, service, config, embedder) {
302
302
  name: "memory_update",
303
303
  description: "Modify an existing memory entry (title, content, type, tags, importance).",
304
304
  parameters: {
305
- id: { type: "string", required: true, description: "Memory id" },
305
+ id: { type: "string", required: true, description: "Memory id (full id from memory_list/memory_search output, or a unique prefix of it)" },
306
306
  title: { type: "string" },
307
307
  content: { type: "string" },
308
308
  type: { type: "string", enum: ["preference", "project", "decision", "history", "user", "fact"] },
@@ -329,7 +329,9 @@ export function createTools(ctx, service, config, embedder) {
329
329
  render: (_args, value) => TEXT_OUTPUT(`Updated memory ${value.memory.id}: ${value.memory.title}`)
330
330
  },
331
331
  async execute(args) {
332
- const memory = service.update(args.id, {
332
+ const resolved = service.resolveMemoryId(args.id);
333
+ if (!resolved.ok) throw new Error(resolved.message);
334
+ const memory = service.update(resolved.id, {
333
335
  title: args.title,
334
336
  content: args.content,
335
337
  type: args.type,
@@ -342,9 +344,9 @@ export function createTools(ctx, service, config, embedder) {
342
344
 
343
345
  defineTool({
344
346
  name: "memory_delete",
345
- description: "Permanently delete a memory entry. Pass id for exact delete, or query to delete the single best-matching entry by text — lets the agent honor 'delete the memory about X' without a prior list/search round trip.",
347
+ description: "Permanently delete a memory entry. Pass id for exact delete (full id, or a unique prefix of it — ambiguous prefixes are rejected), or query to delete the single best-matching entry by text — lets the agent honor 'delete the memory about X' without a prior list/search round trip. An id that matches nothing is logged as a warning instead of failing silently.",
346
348
  parameters: {
347
- id: { type: "string", description: "Exact memory id to delete (from memory_list/memory_search output)" },
349
+ id: { type: "string", description: "Memory id to delete: full id (from memory_list/memory_search output) or a unique prefix of it; a miss is logged (warn) and returns deleted:false" },
348
350
  query: { type: "string", description: "Delete the best-matching entry for this text (searches title/content/tags; uses hybrid recall when an embedder is configured)" }
349
351
  },
350
352
  output: {
@@ -353,13 +355,19 @@ export function createTools(ctx, service, config, embedder) {
353
355
  additionalProperties: false,
354
356
  properties: { deleted: { type: "boolean", required: true } }
355
357
  },
356
- render: (_args, value) => TEXT_OUTPUT(value.deleted ? "Memory deleted." : "Memory not found.")
358
+ render: (_args, value) => TEXT_OUTPUT(value.deleted
359
+ ? "Memory deleted."
360
+ : "Memory not found — nothing was deleted. Pass a full id (or a unique prefix) from memory_list/memory_search output, or delete by query=… instead.")
357
361
  },
358
362
  async execute(args) {
359
363
  if (args.id) {
360
- const existed = service.getById(args.id) !== undefined;
361
- if (existed) service.remove(args.id);
362
- return { deleted: existed };
364
+ const resolved = service.resolveMemoryId(args.id, { warnMiss: true });
365
+ if (!resolved.ok) {
366
+ if (resolved.reason === "ambiguous") throw new Error(resolved.message);
367
+ return { deleted: false };
368
+ }
369
+ service.remove(resolved.id);
370
+ return { deleted: true };
363
371
  }
364
372
  if (args.query) {
365
373
  const [best] = await service.searchMemories(args.query, { mode: "auto", topK: 1, useRerank: true });
@@ -378,7 +386,7 @@ export function createTools(ctx, service, config, embedder) {
378
386
  "Stop a memory from being auto-injected and from appearing in searches and lists without deleting it. " +
379
387
  "The entry stays in storage; pass forgotten: false to restore it.",
380
388
  parameters: {
381
- id: { type: "string", required: true },
389
+ id: { type: "string", required: true, description: "Memory id: full id (from memory_list/memory_search output) or a unique prefix of it; ambiguous prefixes are rejected" },
382
390
  forgotten: { type: "boolean", description: "Suppress (true, default) or restore (false) the entry's visibility" }
383
391
  },
384
392
  output: {
@@ -399,10 +407,9 @@ export function createTools(ctx, service, config, embedder) {
399
407
  render: (_args, value) => TEXT_OUTPUT(`Memory ${value.memory.id} injection ${value.memory.forgotten ? "suppressed" : "restored"}.`)
400
408
  },
401
409
  async execute(args) {
402
- if (service.getById(args.id) === undefined) {
403
- throw new Error("memory not found");
404
- }
405
- const memory = service.setForget(args.id, args.forgotten ?? true);
410
+ const resolved = service.resolveMemoryId(args.id);
411
+ if (!resolved.ok) throw new Error(resolved.message);
412
+ const memory = service.setForget(resolved.id, args.forgotten ?? true);
406
413
  return { memory: { id: memory.id, forgotten: memory.forgotten } };
407
414
  }
408
415
  }),
@@ -414,7 +421,7 @@ export function createTools(ctx, service, config, embedder) {
414
421
  "Archived entries stay in storage and are recoverable: pass archived=false to restore, and use memory_list with " +
415
422
  "include_archived=true to find archived entries.",
416
423
  parameters: {
417
- id: { type: "string", required: true, description: "Memory id" },
424
+ id: { type: "string", required: true, description: "Memory id: full id (from memory_list/memory_search output) or a unique prefix of it; ambiguous prefixes are rejected" },
418
425
  archived: { type: "boolean", description: "Archive (true, default) or restore (false) the entry" }
419
426
  },
420
427
  output: {
@@ -435,10 +442,9 @@ export function createTools(ctx, service, config, embedder) {
435
442
  render: (_args, value) => TEXT_OUTPUT(`Memory ${value.memory.id} ${value.memory.archived ? "archived" : "restored"}.`)
436
443
  },
437
444
  async execute(args) {
438
- if (service.getById(args.id) === undefined) {
439
- throw new Error("memory not found");
440
- }
441
- const memory = service.setArchived(args.id, args.archived ?? true);
445
+ const resolved = service.resolveMemoryId(args.id);
446
+ if (!resolved.ok) throw new Error(resolved.message);
447
+ const memory = service.setArchived(resolved.id, args.archived ?? true);
442
448
  return { memory: { id: memory.id, archived: memory.archived } };
443
449
  }
444
450
  })
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@modusensus/dsh-mneme",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@modusensus/dsh-mneme",
9
- "version": "0.7.5",
9
+ "version": "0.7.7",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@huggingface/transformers": "^4.2.0"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@modusensus/dsh-mneme",
3
3
  "description": "Cross-session memory plugin for DeepSeek Harness with autoDream consolidation: SQLite store, Markdown mirrors, 7 model tools, automatic injection, session summarization, user profile/rules, custom slash commands, vector (semantic) search, and a Web GUI panel",
4
- "version": "0.7.5",
4
+ "version": "0.7.7",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  // Sync the src/ tree into lib/ — the distributable consumed by DSH (package
2
- // main is lib/index.js). lib/client.js (the Web panel bundle) is authored
3
- // independently under lib/ and is left untouched: the sync only copies
4
- // src -> lib, it never prunes lib-only files.
2
+ // main is lib/index.js). src/ is the single source of truth for every module,
3
+ // including client.js (the Web panel bundle); the sync only copies
4
+ // src -> lib and never prunes output files.
5
5
  //
6
6
  // Usage: npm run sync (also run automatically by `npm pack`/`npm publish`
7
7
  // via the prepack hook, so a published tarball always ships a fresh lib/).