dsh-memu-memory 1.2.8 → 1.3.0

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +494 -0
  2. package/README.md +1 -1
  3. package/README.zh.md +1 -1
  4. package/docs/memory-semantics.md +3 -2
  5. package/lib/backup.js +154 -25
  6. package/lib/binding-diagnostics.js +2 -3
  7. package/lib/budget.js +0 -9
  8. package/lib/client.js +221 -128
  9. package/lib/commitment.js +3 -3
  10. package/lib/consolidation-ledger.js +46 -3
  11. package/lib/consolidation-receipt.js +41 -16
  12. package/lib/consolidation-worker.js +34 -10
  13. package/lib/curator-policy.js +23 -0
  14. package/lib/cycle.js +8 -4
  15. package/lib/embedding-download.js +168 -28
  16. package/lib/embedding-runtime.js +76 -17
  17. package/lib/engine.js +0 -6
  18. package/lib/freshness.js +2 -2
  19. package/lib/graph.js +139 -11
  20. package/lib/index.js +71 -20
  21. package/lib/inject.js +50 -7
  22. package/lib/lexicon.js +61 -16
  23. package/lib/local-vector-service.js +21 -1
  24. package/lib/media.js +49 -12
  25. package/lib/memory.js +662 -116
  26. package/lib/paths.js +0 -7
  27. package/lib/preset-scope.js +6 -1
  28. package/lib/private.js +281 -18
  29. package/lib/prompts/private-consolidation.md +2 -2
  30. package/lib/prompts/private-consolidation.rp.md +3 -2
  31. package/lib/prompts.js +0 -7
  32. package/lib/rpc.js +95 -17
  33. package/lib/snippet.js +18 -2
  34. package/lib/state.js +109 -30
  35. package/lib/stats.js +2 -2
  36. package/lib/temporal.js +19 -0
  37. package/lib/text-retrieval.js +120 -44
  38. package/lib/text-similarity.js +205 -24
  39. package/lib/tokenizer-v2.js +0 -24
  40. package/lib/tools.js +62 -62
  41. package/lib/vector-migration.js +15 -0
  42. package/lib/vector-profile.js +81 -8
  43. package/lib/visibility.js +0 -4
  44. package/lib/webui/standalone.css +17 -22
  45. package/lib/webui/standalone.js +27 -9
  46. package/lib/webui.js +4 -4
  47. package/package.json +3 -2
  48. package/scripts/acceptance-local.mjs +2 -2
  49. package/scripts/check-all.mjs +3 -1
  50. package/scripts/check-i18n.mjs +35 -1
  51. package/scripts/migrate-visibility.mjs +3 -3
  52. package/scripts/prune-sessions.mjs +34 -0
  53. package/scripts/prune-vectors.mjs +24 -0
  54. package/tests/appendix-b.test.mjs +5 -4
  55. package/tests/audit-batch3.test.mjs +247 -0
  56. package/tests/audit-regression.test.mjs +2 -2
  57. package/tests/backup.test.mjs +83 -83
  58. package/tests/browser.test.mjs +6 -1
  59. package/tests/client-render.test.mjs +2 -2
  60. package/tests/consolidation-fork.test.mjs +61 -15
  61. package/tests/consolidation-ledger.test.mjs +64 -3
  62. package/tests/consolidation-snapshot.test.mjs +25 -9
  63. package/tests/curator-clusters.test.mjs +18 -0
  64. package/tests/curator-pairing.test.mjs +59 -16
  65. package/tests/dynamic-rrf.test.mjs +22 -19
  66. package/tests/dynamic-threshold.test.mjs +52 -0
  67. package/tests/fact-version.test.mjs +18 -0
  68. package/tests/fixtures/tokenizer-cases.mjs +27 -0
  69. package/tests/graph-cascade.test.mjs +29 -0
  70. package/tests/graph.test.mjs +45 -0
  71. package/tests/inject-conflict.test.mjs +18 -0
  72. package/tests/injection-chain.test.mjs +2 -2
  73. package/tests/lexical-bm25.test.mjs +171 -0
  74. package/tests/lexicon-frequency.test.mjs +16 -0
  75. package/tests/lexicon-inject.test.mjs +21 -0
  76. package/tests/lexicon-perf.test.mjs +37 -9
  77. package/tests/lexicon-scope.test.mjs +2 -2
  78. package/tests/lexicon-ui.test.mjs +1 -1
  79. package/tests/managed-memory.test.mjs +19 -0
  80. package/tests/ops-hardening.test.mjs +209 -0
  81. package/tests/package-shipping.test.mjs +4 -0
  82. package/tests/prompt-semantics.test.mjs +1 -1
  83. package/tests/prompts.test.mjs +1 -1
  84. package/tests/recall-intent.test.mjs +23 -0
  85. package/tests/slot-similarity.test.mjs +153 -0
  86. package/tests/state-gc.test.mjs +34 -0
  87. package/tests/state.test.mjs +2 -2
  88. package/tests/tokenizer-v2.test.mjs +1 -1
  89. package/tests/vector-gc.test.mjs +37 -0
  90. package/tests/webui.test.mjs +27 -0
package/lib/tools.js CHANGED
@@ -267,19 +267,19 @@ export function registerTools(ctx, { only = null } = {}) {
267
267
 
268
268
  tools.push(toolBase(
269
269
  'memu_private_remember',
270
- 'Write one useful private memory in the bound library. Match the domain: engineering facts, logic and verification in coding; grounded in-character experiences in RP; neutral facts and preferences in general. Do not copy a transcript or invent evidence. layer=must_remember requires pin_reason and pin_source (user_explicit, side_event, self).',
270
+ 'Write one durable private memory. Match the domain; never copy a transcript or invent evidence. layer=must_remember requires pin_reason and pin_source.',
271
271
  {
272
- content: { type: 'string', required: true, description: 'Self-contained content appropriate to the domain. Coding: conclusion, scope/symbol, logic/conditions and verification; preserve necessary minimal code exactly. RP: an evidenced moment and its effect on later interaction, without invented facts.' },
273
- title: { type: 'string', description: '8-40 characters. This title is a permanent index: the anchor and turn recall show it WITHOUT the body, so it must name the concrete fact — people/objects/events or the conclusion keywords ("Yuike 名字来自小时候的白猫", "Postgres 连接池上限改为 40"). Never an empty label like "一些事" / "那段对话" / "关于XX的事"; the details belong in content. Defaults to the content when omitted.' },
274
- layer: { type: 'string', description: 'long_term (default), short_term, or must_remember. short_term is a draft with a deadline: it expires after shortTermTtlHours unless promoted to long_term before then. Use it for what only has to survive this stretch of conversation.' },
272
+ content: { type: 'string', required: true, description: 'Self-contained 50-170 char body: people, place, time, event, exact words. Coding keeps conclusion and verification; RP keeps evidenced moments, no invented facts.' },
273
+ title: { type: 'string', description: '8-40 chars naming the concrete fact; title is a permanent index, the anchor shows only titles WITHOUT the body. No empty labels. Defaults to content.' },
274
+ layer: { type: 'string', description: 'long_term (default), short_term, must_remember. short_term expires unless promoted.' },
275
275
  pin_reason: { type: 'string', description: 'Required for must_remember; first-person reason.' },
276
276
  pin_source: { type: 'string', description: 'user_explicit, side_event, or self.' },
277
277
  side_event_id: { type: 'string', description: 'Required when pin_source=side_event.' },
278
- fact_key: { type: 'string', description: 'Optional stable key for the fact, such as "user:floor_color". Passing it declares that an existing active memory with the same key is another version of this fact; the new entry then becomes a conflict pair unless you pass supersedes.' },
279
- conflicts_with: { type: 'string', description: 'Id of an existing memory that says something different about the same fact. Both versions stay active and are recalled together with a conflict card; use this instead of overwriting or deleting the old claim.' },
280
- supersedes: { type: 'string', description: 'Id of an existing memory this new statement explicitly replaces. The old row keeps its text but is retired (superseded + valid_to). Use only when the newer statement really is the corrected truth.' },
278
+ fact_key: { type: 'string', description: 'Optional stable key. Reusing it marks another version of the same fact (conflict pair unless supersedes).' },
279
+ conflicts_with: { type: 'string', description: 'Existing memory id with a different version of the same fact; both stay active and recall together.' },
280
+ supersedes: { type: 'string', description: 'Existing memory id this explicitly replaces; old text stays but is retired.' },
281
281
  tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags.' },
282
- open_loop: { type: 'boolean', description: 'Mark an unfinished promise/task/unsaid thing. Prefer the commitment object; this boolean remains for compatibility and is kept in sync with commitment.status.' },
282
+ open_loop: { type: 'boolean', description: 'Unfinished promise/task; prefer commitment.' },
283
283
  commitment: {
284
284
  type: 'object',
285
285
  properties: {
@@ -291,51 +291,51 @@ export function registerTools(ctx, { only = null } = {}) {
291
291
  evidence_seq: { type: 'integer' },
292
292
  },
293
293
  additionalProperties: false,
294
- description: 'A promise or arrangement: counterparty (who it is with), action (what was promised), due_at (YYYY-MM-DD or ISO), status (open/done/cancelled/expired), closed_by / evidence_seq (proof of fulfilment). Use status=open only while it is still owed; update it when it is done or cancelled.',
294
+ description: 'Promise: counterparty, action, due_at (YYYY-MM-DD/ISO), status (open/done/cancelled/expired), closed_by/evidence_seq.',
295
295
  },
296
- disclosure: { type: 'string', description: 'can_tell, only_if_asked, or never_say.' },
297
- owner: { type: 'string', description: 'me, us, about_user, or about_project.' },
298
- visibility: { type: 'string', description: 'shared (default: the whole folder) or secret (kept out of the prompt and out of automatic recall; still readable by an explicit recall from the same folder). Scope a memory to one channel / character / world / branch with the context field instead of trying to hide it.' },
296
+ disclosure: { type: 'string', description: 'can_tell, only_if_asked, never_say.' },
297
+ owner: { type: 'string', description: 'me, us, about_user, about_project.' },
298
+ visibility: { type: 'string', description: 'shared (default) or secret (no automatic injection/recall).' },
299
299
  source: {
300
300
  type: 'string',
301
- description: 'Where this came from: inferred (default — you concluded it), user_said (only when the words are actually theirs and quotable), assistant_said (your own promise, plan or claim), imagined, told, or tool (read from a tool result).',
301
+ description: 'inferred (default), user_said (quotable), assistant_said, imagined, told, tool.',
302
302
  },
303
- source_kind: { type: 'string', description: 'Provenance detail: user_said, assistant_said, told, imagined, inferred, or tool. Defaults to source. Assistant promises and plans belong here; never file them as user_said.' },
304
- speaker_id: { type: 'string', description: 'Stable identity of who said it: user, assistant, character:<id>, or group:<id>. Never infer from a display name. Defaults to the conversation speaker or user/assistant by source_kind.' },
303
+ source_kind: { type: 'string', description: 'Same values as source; assistant promises/plans must not be user_said.' },
304
+ speaker_id: { type: 'string', description: 'user, assistant, character:<id>, group:<id>; never infer from a name.' },
305
305
  quote_span: {
306
306
  type: 'object',
307
307
  properties: { seq: { type: 'integer' }, turn: { type: 'integer' }, textHash: { type: 'string' } },
308
308
  additionalProperties: false,
309
- description: 'Optional pointer back to the source turn: seq/turn numbers plus a short text hash. Do not paste the whole quote here.',
309
+ description: 'Optional source pointer; do not paste the whole quote.',
310
310
  },
311
- storyline_id: { type: 'string', description: 'Optional storyline / plot thread id when several stories share one library.' },
312
- branch_id: { type: 'string', description: 'Optional branch id; defaults to the conversation branch.' },
313
- known_by: { type: 'array', items: { type: 'string' }, description: 'Character identities that know this fact. Omit to inherit the conversation boundary.' },
314
- confidence: { type: 'number', description: '0-1 confidence in this memory. Below 0.45 it is injected as a hedge, so use it honestly.' },
315
- mood_valence: { type: 'number', description: '派生值:给了 emotion 时由四项算出,-1(坏)到 1(好)。省略则沿用当前会话读数。' },
316
- arousal: { type: 'number', description: 'How strongly it hit, 0-1.' },
311
+ storyline_id: { type: 'string', description: 'Optional storyline id.' },
312
+ branch_id: { type: 'string', description: 'Optional branch id.' },
313
+ known_by: { type: 'array', items: { type: 'string' }, description: 'Character ids that know this fact.' },
314
+ confidence: { type: 'number', description: '0-1; below 0.45 is injected as a hedge.' },
315
+ mood_valence: { type: 'number', description: '-1..1; omit to inherit the conversation reading.' },
316
+ arousal: { type: 'number', description: '0-1 intensity.' },
317
317
  emotion: {
318
318
  type: 'object',
319
319
  properties: { joy: { type: 'number' }, anger: { type: 'number' }, sorrow: { type: 'number' }, fear: { type: 'number' } },
320
320
  // 四个轴是封闭集合:多写的键只会被误当成第五种情绪。
321
321
  additionalProperties: false,
322
- description: '情绪构成:喜悦/愤怒/哀伤/恐惧,四项自动归一化到和为 1。填记忆所述那件事的情绪,不是此刻整理时的心情。省略=继承当前会话读数;显式全零=明确中性;工程事实请用中性,不要因为 bug 难修或结论重要就填负面情绪。',
322
+ description: 'joy/anger/sorrow/fear for the remembered event, not the consolidation mood. Omit to inherit; all-zero is neutral.',
323
323
  },
324
- dominance: { type: 'number', description: '谁在掌控:-1 完全失控 … +1 完全掌控。省略=继承当前会话。' },
325
- peak: { type: 'boolean', description: 'A high point or low point of the arc — peaks and endings stay easier to recall.' },
326
- allow_duplicate: { type: 'boolean', description: 'Only for two genuinely independent observations of the same fact (e.g. the same event recorded twice in one day). The default false refuses a near-identical rewrite and returns the existing memory id; passing true states you looked at that existing memory and still want a separate entry.' },
327
- salient_date: { type: 'string', description: 'MM-DD for something that comes back every year (a birthday, an anniversary of an event); it resurfaces on that day each year. YYYY-MM-DD for a one-off dated commitment or appointment: it is raised the day before and on the day itself, and never again after it has passed. Use the annual form only when the day really does recur. A relative day (今天/明天/后天/today/tomorrow) must be resolved to the absolute date it points at: sending a bare MM-DD turns one appointment into a yearly reminder. If the content itself names a date, pass it here too: when this field is empty the plugin only falls back to a single unambiguous YYYY-MM-DD found in the text.' },
328
- observed_at: { type: 'string', description: 'ISO date/time when this statement was made (the scene time). Omit to use the conversation sceneTime. Relative dates are resolved against this instant, never against the wall clock.' },
329
- absolute_date: { type: 'string', description: 'YYYY-MM-DD this memory is about, when you already know it. The plugin also resolves 今天/明天/下周X/月底 itself against observed_at; pass this only to override or when the wording has no parseable date.' },
330
- valid_from: { type: 'string', description: 'Optional YYYY-MM-DD from which the fact is true. Omit for facts with no known start.' },
331
- valid_to: { type: 'string', description: 'Optional YYYY-MM-DD after which the fact is no longer true. Omit for open-ended facts; the entry is hidden from recall after this day.' },
332
- date_precision: { type: 'string', description: 'day (default for a concrete date), month (月底/下个月), year (年初/年底), or unknown (relative wording that could not be resolved).' },
333
- track: { type: 'string', description: 'memory (default) or habit for an aggregated expression/sticker habit; do not write one habit per occurrence.' },
334
- attachments: { type: 'array', items: { type: 'object', properties: { sha256: { type: 'string', required: true } }, additionalProperties: true }, description: 'At most 8 sha256 references received in this conversation. Never supply paths or bytes. Ordinary image memories default to short_term if layer is omitted; choose long_term explicitly only when important.' },
324
+ dominance: { type: 'number', description: '-1..1; omit to inherit.' },
325
+ peak: { type: 'boolean', description: 'High/low point of the arc.' },
326
+ allow_duplicate: { type: 'boolean', description: 'Only for a genuinely independent second observation; default false refuses near-duplicates.' },
327
+ salient_date: { type: 'string', description: 'MM-DD for yearly recurrence; YYYY-MM-DD for a one-off appointment. Resolve 今天/明天/下周 to the absolute date; never send a bare MM-DD for a one-off.' },
328
+ observed_at: { type: 'string', description: 'ISO scene time of this statement; relative dates resolve against it, never the wall clock. Omit to use the conversation sceneTime.' },
329
+ absolute_date: { type: 'string', description: 'YYYY-MM-DD this fact is about; omit to let the plugin resolve observed_at + relative wording.' },
330
+ valid_from: { type: 'string', description: 'Optional YYYY-MM-DD when the fact starts.' },
331
+ valid_to: { type: 'string', description: 'Optional YYYY-MM-DD after which it no longer holds.' },
332
+ date_precision: { type: 'string', description: 'day, month, year, or unknown.' },
333
+ track: { type: 'string', description: 'memory (default) or habit (aggregated repeated expression).' },
334
+ attachments: { type: 'array', items: { type: 'object', properties: { sha256: { type: 'string', required: true } }, additionalProperties: true }, description: 'At most 8 sha256 refs received in this conversation; never paths or bytes.' },
335
335
  context: { type: 'object', properties: {
336
336
  speakerId: { type: 'string' }, channelId: { type: 'string' }, characterId: { type: 'string' }, worldId: { type: 'string' }, branchId: { type: 'string' },
337
337
  knownBy: { type: 'array', items: { type: 'string' } }, occurredAt: { type: 'string' },
338
- }, additionalProperties: true, description: 'Stable identities only; do not infer from a display name. Channel, character, world and branch inherit the configured conversation scope; cannot cross it. speakerId records whose words these were, knownBy limits character knowledge, occurredAt must be explicit.' },
338
+ }, additionalProperties: true, description: 'Stable identities only; scope inherits the conversation and cannot widen it.' },
339
339
  },
340
340
  async (args, exec) => {
341
341
  const result = await privateRemember({
@@ -462,14 +462,14 @@ export function registerTools(ctx, { only = null } = {}) {
462
462
 
463
463
  tools.push(toolBase(
464
464
  'memu_private_update',
465
- 'Update a private memory in the bound library. Changing content rewrites the memory in MemU; metadata-only changes stay local. If the new content covers more than the old title says, rewrite the title under the same rule.',
465
+ 'Update a private memory. Content changes rewrite the stored body; metadata-only changes stay local. Rewrite the title when the new body no longer fits it.',
466
466
  {
467
467
  id: { type: 'string', required: true, description: 'Memory id.' },
468
- content: { type: 'string', description: 'New body.' },
469
- title: { type: 'string', description: 'New title under the same rule as memu_private_remember.title: 8-40 characters that name the concrete fact (people/objects/events or conclusion keywords), because the anchor shows only titles. Never an empty label like "关于XX的事"; details stay in content. Omit to keep the current title.' },
468
+ content: { type: 'string', description: 'New 50-170 char body.' },
469
+ title: { type: 'string', description: '8-40 chars naming the concrete fact; title is a permanent index, the anchor shows only titles WITHOUT the body. No empty labels. Omit to keep.' },
470
470
  tags: { type: 'array', items: { type: 'string' } },
471
- status: { type: 'string', description: 'active, archived, fragment, suppressed, or expired.' },
472
- layer: { type: 'string', description: 'long_term to promote a short_term draft once it has proven worth keeping, or short_term to re-arm the deadline. must_remember needs a pin_reason and is only writable through memu_private_remember.' },
471
+ status: { type: 'string', description: 'active, archived, fragment, suppressed, expired.' },
472
+ layer: { type: 'string', description: 'long_term (promote), short_term (re-arm expiry); must_remember only via remember.' },
473
473
  open_loop: { type: 'boolean' },
474
474
  commitment: {
475
475
  type: 'object',
@@ -482,38 +482,38 @@ export function registerTools(ctx, { only = null } = {}) {
482
482
  evidence_seq: { type: 'integer' },
483
483
  },
484
484
  additionalProperties: false,
485
- description: 'Replace the commitment object. Set status=done/cancelled/expired to close it; open_loop follows status.',
485
+ description: 'Replace commitment; status=done/cancelled/expired closes it.',
486
486
  },
487
- disclosure: { type: 'string', description: 'can_tell, only_if_asked, or never_say. Changing this changes how the memory is phrased when it is injected.' },
488
- owner: { type: 'string', description: 'me, us, about_user, or about_project.' },
489
- visibility: { type: 'string', description: 'shared or secret. secret keeps it out of the prompt and out of automatic recall; an explicit recall from the same folder can still read it.' },
487
+ disclosure: { type: 'string', description: 'can_tell, only_if_asked, never_say.' },
488
+ owner: { type: 'string', description: 'me, us, about_user, about_project.' },
489
+ visibility: { type: 'string', description: 'shared or secret.' },
490
490
  confidence: { type: 'number' },
491
491
  // Provenance and track are claims about what a memory *is*; both were writable
492
492
  // in memory.js and the panel while staying unreachable from the tool surface,
493
493
  // so the agent could file a quote as an inference and never correct it.
494
- source: { type: 'string', description: 'user_said, assistant_said, told, imagined, inferred, or tool. Only user_said may be repeated as the user\'s own words, so correct this rather than living with a wrong provenance.' },
495
- source_kind: { type: 'string', description: 'Same values as source; correcting the provenance must keep this in sync.' },
496
- speaker_id: { type: 'string', description: 'Who said it: user, assistant, character:<id>, or group:<id>. Empty string clears it.' },
497
- quote_span: { type: 'object', properties: { seq: { type: 'integer' }, turn: { type: 'integer' }, textHash: { type: 'string' } }, additionalProperties: false, description: 'Pointer back to the source turn; omit to keep, null to clear.' },
498
- storyline_id: { type: 'string', description: 'Storyline / plot thread id; empty string clears it.' },
499
- branch_id: { type: 'string', description: 'Branch id; empty string clears it.' },
500
- known_by: { type: 'array', items: { type: 'string' }, description: 'Character identities that know this fact; empty array clears it.' },
501
- track: { type: 'string', description: 'memory or habit. habit folds repeat attachments of the same fact into one entry; a wrong track changes that aggregation and can now be corrected.' },
502
- peak: { type: 'boolean', description: 'Flashbulb flag: the moment was charged. Changing it recomputes accuracy.' },
503
- mood_valence: { type: 'number', description: 'How the moment felt, -1..1. Used as a retrieval lens; omitted keeps the stored value.' },
504
- arousal: { type: 'number', description: 'How charged the moment was, 0..1. Used as a retrieval lens; omitted keeps the stored value.' },
494
+ source: { type: 'string', description: 'user_said, assistant_said, told, imagined, inferred, tool.' },
495
+ source_kind: { type: 'string', description: 'Same values as source; keep in sync.' },
496
+ speaker_id: { type: 'string', description: 'user, assistant, character:<id>, group:<id>; empty clears.' },
497
+ quote_span: { type: 'object', properties: { seq: { type: 'integer' }, turn: { type: 'integer' }, textHash: { type: 'string' } }, additionalProperties: false, description: 'Source pointer; omit to keep, null to clear.' },
498
+ storyline_id: { type: 'string', description: 'Storyline id; empty clears.' },
499
+ branch_id: { type: 'string', description: 'Branch id; empty clears.' },
500
+ known_by: { type: 'array', items: { type: 'string' }, description: 'Character ids; empty clears.' },
501
+ track: { type: 'string', description: 'memory or habit.' },
502
+ peak: { type: 'boolean', description: 'Flashbulb flag.' },
503
+ mood_valence: { type: 'number', description: '-1..1 retrieval lens; omit keeps.' },
504
+ arousal: { type: 'number', description: '0..1 retrieval lens; omit keeps.' },
505
505
  emotion: {
506
506
  type: 'object',
507
507
  properties: { joy: { type: 'number' }, anger: { type: 'number' }, sorrow: { type: 'number' }, fear: { type: 'number' } },
508
508
  additionalProperties: false,
509
- description: '情绪构成,三项语义不同:省略=保留原值;显式 null=清除 emotion,来源变 unknown;显式对象=校验并归一化后整份替换。改的是那条记忆所述事件的感受,不是此刻的心情。',
509
+ description: 'Omit keeps; null clears; object replaces after normalisation. Event feeling, not current mood.',
510
510
  },
511
- dominance: { type: 'number', description: '谁在掌控:-1 完全失控 … +1 完全掌控。省略=保留原值。' },
512
- salient_date: { type: 'string', description: 'Re-date the memory: MM-DD for an annual anniversary, YYYY-MM-DD for a one-off dated commitment, or an empty string to remove the date. Use this to repair a date that was stored without its year.' },
513
- observed_at: { type: 'string', description: 'ISO scene time for this edit; relative dates in the new text resolve against it. Omit to use the conversation sceneTime.' },
514
- absolute_date: { type: 'string', description: 'YYYY-MM-DD this memory is about. Omit to re-derive from the new title/content; pass an empty string to clear it.' },
515
- valid_from: { type: 'string', description: 'YYYY-MM-DD the fact starts being true; empty string clears it.' },
516
- valid_to: { type: 'string', description: 'YYYY-MM-DD the fact stops being true; empty string clears it.' },
511
+ dominance: { type: 'number', description: '-1..1; omit keeps.' },
512
+ salient_date: { type: 'string', description: 'MM-DD yearly or YYYY-MM-DD one-off; empty clears.' },
513
+ observed_at: { type: 'string', description: 'ISO scene time for this edit; omit uses conversation sceneTime.' },
514
+ absolute_date: { type: 'string', description: 'YYYY-MM-DD; omit re-derives, empty clears.' },
515
+ valid_from: { type: 'string', description: 'YYYY-MM-DD start; empty clears.' },
516
+ valid_to: { type: 'string', description: 'YYYY-MM-DD end; empty clears.' },
517
517
  },
518
518
  async (args, exec) => {
519
519
  const result = await privateUpdate({
@@ -172,6 +172,11 @@ export function createVectorMigrator(options = {}) {
172
172
  listFiles: configured.listFiles ?? configured.list,
173
173
  retrieve: typeof configured.retrieve === 'function' ? configured.retrieve : null,
174
174
  smoke: typeof configured.smoke === 'function' ? configured.smoke : null,
175
+ // Optional: drop the index-side `vectorPending` marker for ids that this rebuild
176
+ // has just proven present in the shadow. Without it the marker was write-only —
177
+ // nothing ever cleared it after a successful migration, so a fully migrated
178
+ // library kept advertising itself as "not in the vector store yet".
179
+ clearVectorPending: typeof configured.clearVectorPending === 'function' ? configured.clearVectorPending : null,
175
180
  }
176
181
  for (const name of REQUIRED_DEPS) {
177
182
  if (typeof impl[name] !== 'function') throw new TypeError('createVectorMigrator requires a ' + name + '(… ) dependency')
@@ -527,6 +532,16 @@ export function createVectorMigrator(options = {}) {
527
532
  const verifiedPresent = await presentIds(scope, profile, generation)
528
533
  if (verifiedPresent.size !== known.size || [...known].some(id => !verifiedPresent.has(id))) {
529
534
  report.failed.push({ libraryId: scope.key, code: 'VECTOR_COVERAGE_FAILED', message: 'shadow membership differs from eligible index snapshot' })
535
+ } else if (impl.clearVectorPending) {
536
+ // Coverage passed: every admitted entry is provably in this generation's
537
+ // shadow, so "write me into the vector store later" is finished for all of
538
+ // them. Fail-open — a stale flag costs a little wasted work next rebuild, it
539
+ // must never turn a successful migration into a failed one.
540
+ try {
541
+ impl.clearVectorPending({ libraryId: scope.libraryId, ids: [...known], generation })
542
+ } catch (error) {
543
+ log('clear vectorPending failed for ' + scope.key + ': ' + (error?.message || error))
544
+ }
530
545
  }
531
546
  bucket.snapshot = { digest: before.scopes[index].digest, items: items.length, at: before.at }
532
547
  report.libraries[scope.key] = { items: items.length, present: present.size, digest: before.scopes[index].digest }
@@ -130,13 +130,6 @@ export function manifestDigestAccepted(stored, manifest) {
130
130
  /** 直接复用 embedding-catalog 的指纹协议(任何改变向量空间的字段都进指纹,§14.8)。 */
131
131
  export { profileFingerprint }
132
132
 
133
- export function profileShortFingerprint(profileOrEntry) {
134
- const fingerprint = typeof profileOrEntry === 'string'
135
- ? profileOrEntry
136
- : (profileOrEntry?.fingerprint || profileFingerprint(profileOrEntry))
137
- return String(fingerprint).slice(0, 8)
138
- }
139
-
140
133
  // ---------------------------------------------------------------- catalog 注入点
141
134
 
142
135
  // 默认只认 embedding-catalog.js 的目录。测试(以及将来多目录场景)可以换一个解析器:
@@ -989,4 +982,84 @@ export const activeVectorState = vectorState
989
982
  export const memuDbFor = dbPathFor
990
983
  export const memuGlobalDbFor = () => dbPathFor(null)
991
984
  export const captureVectorGeneration = captureGeneration
992
- export const assertVectorGeneration = assertGeneration
985
+ export const assertVectorGeneration = assertGeneration
986
+ // ---------------------------------------------------------------- P2-5 vector GC
987
+ //
988
+ // Generation files are safe to collect only when they are (a) not referenced by
989
+ // the active/pending manifest, (b) older than the active generation by the
990
+ // configured keep count, and (c) older than a retention window. The pure
991
+ // candidate filter is exported so the script and tests share exactly one rule.
992
+ const VECTOR_GC_DAY_MS = 86_400_000
993
+
994
+ export function vectorGcCandidates({
995
+ files = [], activeGeneration = 0, keepGenerations = 2, olderThanDays = 7,
996
+ now = Date.now(), keepPaths = [],
997
+ } = {}) {
998
+ const keepGenerationsCount = Math.max(1, Number(keepGenerations) || 2)
999
+ const minKeep = Math.max(0, (Number(activeGeneration) || 0) - (keepGenerationsCount - 1))
1000
+ const cutoff = Number(now) - Math.max(0, Number(olderThanDays) || 0) * VECTOR_GC_DAY_MS
1001
+ const keep = new Set((keepPaths || []).map((file) => path.resolve(String(file))))
1002
+ return (files || []).filter((item) => {
1003
+ const generation = Number(item?.generation)
1004
+ if (!Number.isSafeInteger(generation) || generation < 1) return false
1005
+ if (generation >= minKeep) return false
1006
+ if (keep.has(path.resolve(String(item.file)))) return false
1007
+ return Number(item.mtimeMs) < cutoff
1008
+ })
1009
+ }
1010
+
1011
+ export function listVectorArtifacts() {
1012
+ const state = readVectorState({ tolerateMissing: true }).state
1013
+ const keepPaths = []
1014
+ const collect = (manifest) => {
1015
+ if (!manifest?.databases) return
1016
+ const global = manifest.databases.global
1017
+ if (global?.path) keepPaths.push(resolveVectorPath(global.path))
1018
+ for (const entry of Object.values(manifest.databases.libraries || {})) {
1019
+ if (entry?.path) keepPaths.push(resolveVectorPath(entry.path))
1020
+ }
1021
+ }
1022
+ collect(state?.active)
1023
+ collect(state?.pending?.databases ? { databases: state.pending.databases } : null)
1024
+ const files = []
1025
+ for (const dir of [librariesDir(), indexDir()]) {
1026
+ let names = []
1027
+ try { names = fs.readdirSync(dir) } catch { continue }
1028
+ for (const name of names) {
1029
+ const match = /\.g(\d+)\.(?:sqlite3|json)$/.exec(name)
1030
+ if (!match) continue
1031
+ if (!name.endsWith('.sqlite3') && !name.startsWith('vector-ledger.')) continue
1032
+ const file = path.join(dir, name)
1033
+ let info
1034
+ try { info = fs.statSync(file) } catch { continue }
1035
+ files.push({ file, generation: Number(match[1]), bytes: info.size, mtimeMs: info.mtimeMs })
1036
+ }
1037
+ }
1038
+ return { activeGeneration: state?.active?.generation ?? 0, keepPaths, files }
1039
+ }
1040
+
1041
+ export function pruneVectorArtifacts({ apply = false, keepGenerations = 2, olderThanDays = 7, now = Date.now() } = {}) {
1042
+ const info = listVectorArtifacts()
1043
+ const candidates = vectorGcCandidates({
1044
+ files: info.files,
1045
+ activeGeneration: info.activeGeneration,
1046
+ keepGenerations,
1047
+ olderThanDays,
1048
+ now,
1049
+ keepPaths: info.keepPaths,
1050
+ })
1051
+ const removed = []
1052
+ if (apply) {
1053
+ for (const item of candidates) {
1054
+ try { fs.unlinkSync(item.file); removed.push(item.file) } catch {}
1055
+ }
1056
+ }
1057
+ return {
1058
+ dryRun: apply !== true,
1059
+ activeGeneration: info.activeGeneration,
1060
+ keepGenerations,
1061
+ olderThanDays,
1062
+ candidates: candidates.map((item) => ({ file: item.file, generation: item.generation, bytes: item.bytes })),
1063
+ removed,
1064
+ }
1065
+ }
package/lib/visibility.js CHANGED
@@ -16,10 +16,6 @@
16
16
  export const STORED_VISIBILITIES = ['shared', 'secret']
17
17
  export const LEGACY_SESSION = 'session'
18
18
 
19
- export function normalizeVisibility(value) {
20
- return value === LEGACY_SESSION ? 'shared' : value
21
- }
22
-
23
19
  export function isLegacySession(entry) {
24
20
  return entry?.visibility === LEGACY_SESSION
25
21
  }
@@ -455,9 +455,6 @@ body[data-scrolled="true"] .topbar {
455
455
  #root {
456
456
  min-height: 50vh;
457
457
  }
458
- .boot-failed #root::before {
459
- content: "";
460
- }
461
458
 
462
459
  /* ── footer ────────────────────────────────────────────────────────────── */
463
460
  .foot {
@@ -619,11 +616,9 @@ html[data-standalone] .dshm-root {
619
616
  padding: 0;
620
617
  min-height: 0;
621
618
  animation: none;
622
- /* The component uses container queries inside the host pane. On a full page
623
- `contain: layout` would also make it the containing block for the detail
624
- drawer's fixed overlay, pinning it under the topbar; the media queries above
625
- already cover the narrow layout. */
626
- container-type: normal;
619
+ /* Keep the query container alive in the standalone shell too, so UI_CSS's
620
+ @container rules drive the narrow layout in both shells (see UI_CSS). */
621
+ container-type: inline-size;
627
622
  --dshm-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
628
623
  }
629
624
  html[data-standalone] .dshm-shell {
@@ -651,7 +646,7 @@ html[data-standalone] .dshm-nav {
651
646
  z-index: 20;
652
647
  }
653
648
  html[data-standalone] .dshm-nav::before {
654
- content: "MEMORY STUDIO";
649
+ content: var(--dshm-studio-label, "MEMORY STUDIO");
655
650
  display: block;
656
651
  padding: 4px 12px 10px;
657
652
  font-size: 9px;
@@ -922,8 +917,8 @@ html[data-standalone] .dshm-error {
922
917
  margin: 2px 0;
923
918
  padding: 8px 12px;
924
919
  border-radius: 11px;
925
- border: 1px solid color-mix(in srgb, var(--dshm-error, #b43e45) 30%, transparent);
926
- background: color-mix(in srgb, var(--dshm-error, #b43e45) 10%, transparent);
920
+ border: 1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary, #b43e45) 30%, transparent);
921
+ background: color-mix(in srgb, var(--dsw-alias-state-error-primary, #b43e45) 10%, transparent);
927
922
  font-size: 12.5px;
928
923
  }
929
924
 
@@ -960,15 +955,19 @@ html[data-standalone] .dshm-wall-grid {
960
955
  }
961
956
  html[data-standalone] .dshm-wall-item {
962
957
  min-height: 236px;
958
+ /* Skip layout/paint for rows outside the viewport: a fullscreen wall can hold
959
+ 300 cards, and rendering all of them is what starves the WebView2 compositor. */
960
+ content-visibility: auto;
961
+ contain-intrinsic-size: auto 236px;
963
962
  padding: 18px;
964
963
  border-radius: 18px;
965
964
  border: 1px solid var(--dshm-line);
965
+ /* No backdrop-filter here. A fullscreen wall puts dozens of blurred cards on
966
+ screen at once; the pointer spotlight repaints their backdrop every frame
967
+ and WebView2 starts dropping compositor tiles (cards flash, then vanish).
968
+ The gradients below already carry the depth. */
966
969
  background:
967
- linear-gradient(180deg,
968
- color-mix(in srgb, var(--dshm-panel-strong) 92%, transparent),
969
- color-mix(in srgb, var(--dshm-panel) 82%, transparent));
970
- -webkit-backdrop-filter: blur(14px);
971
- backdrop-filter: blur(14px);
970
+ linear-gradient(180deg, var(--dshm-panel-strong), var(--dshm-panel));
972
971
  box-shadow: 0 18px 36px -32px rgba(10, 28, 23, .5);
973
972
  transition: transform .28s cubic-bezier(.22, 1, .36, 1), box-shadow .28s ease,
974
973
  border-color .28s ease;
@@ -998,9 +997,7 @@ html[data-standalone] .dshm-wall-cover-count {
998
997
  bottom: 10px;
999
998
  font-size: 10.5px;
1000
999
  letter-spacing: .01em;
1001
- background: rgba(10, 16, 32, .62);
1002
- -webkit-backdrop-filter: blur(6px);
1003
- backdrop-filter: blur(6px);
1000
+ background: rgba(10, 16, 32, .72);
1004
1001
  }
1005
1002
  html[data-standalone] .dshm-wall-meta {
1006
1003
  font-size: 11px;
@@ -1036,7 +1033,6 @@ html[data-standalone] .dshm-drawer {
1036
1033
  border-left-color: var(--dshm-line);
1037
1034
  box-shadow: -30px 0 80px -40px rgba(0, 0, 0, .55);
1038
1035
  }
1039
- html[data-standalone] .dshm-drawer .dshm-input,
1040
1036
  html[data-standalone] .dshm-drawer input,
1041
1037
  html[data-standalone] .dshm-drawer textarea,
1042
1038
  html[data-standalone] .dshm-drawer select {
@@ -1104,7 +1100,6 @@ html[data-standalone] .dshm-wall-graph {
1104
1100
 
1105
1101
  /* ── responsive ────────────────────────────────────────────────────────── */
1106
1102
  @media (max-width: 760px) {
1107
- html[data-standalone] .dshm-shell { grid-template-columns: minmax(0, 1fr); gap: 16px; }
1108
1103
  html[data-standalone] .dshm-nav { position: static; }
1109
1104
  html[data-standalone] .dshm-nav-list { flex-direction: row; flex-wrap: wrap; }
1110
1105
  html[data-standalone] .dshm-nav-ind { display: none; }
@@ -1112,7 +1107,7 @@ html[data-standalone] .dshm-wall-graph {
1112
1107
  }
1113
1108
  @media (max-width: 1120px) {
1114
1109
  :root { --dshm-rail: 186px; --dshm-gap: 24px; }
1115
- .stage { padding: 22px 22px 48px; }
1110
+ .stage { padding: 22px 22px 48px calc(var(--dshm-rail) + 38px); }
1116
1111
  }
1117
1112
  @media (max-width: 900px) {
1118
1113
  .topbar { top: 8px; width: calc(100% - 16px); margin-top: 8px; padding: 10px 12px; }
@@ -10,6 +10,7 @@
10
10
  backToDsh: '返回 DSH', close: '关闭', back: '返回',
11
11
  footer: '与 DSH 共用同一份记忆 · 本地优先', opening: '正在打开记忆工作室…',
12
12
  bootFailed: '打不开记忆工作台', reload: '重新加载', unknown: '未知错误',
13
+ studioLabel: '记忆工作室',
13
14
  },
14
15
  en: {
15
16
  skip: 'Skip to content', brand: 'MemU Memory', memories: 'Memories', sync: 'Local memory',
@@ -17,18 +18,22 @@
17
18
  backToDsh: 'Back to DSH', close: 'Close', back: 'Back',
18
19
  footer: 'Shares the same memory as DSH · local-first', opening: 'Opening the memory studio…',
19
20
  bootFailed: 'The memory studio failed to open', reload: 'Reload', unknown: 'Unknown error',
21
+ studioLabel: 'MEMORY STUDIO',
20
22
  },
21
23
  }
24
+ // 页序只留这一份 slug 清单;PAGE_NAMES 的键由 check-i18n.mjs 与
25
+ // client.js 的 SETTINGS_PAGES 对齐校验,避免第三份清单漂移。
26
+ var SETTINGS_PAGES = ['engine', 'connection', 'settings', 'folders', 'libraries', 'browser', 'global', 'prompts', 'stats', 'memories', 'logs', 'lexicon', 'help']
22
27
  var PAGE_NAMES = {
23
28
  zh: {
24
- engine: '引擎与连接', settings: '记忆设置', folders: '文件夹', libraries: '记忆库',
29
+ engine: '引擎与连接', connection: '连接与向量', settings: '记忆设置', folders: '文件夹', libraries: '记忆库',
25
30
  browser: '记忆浏览', global: '全局记忆', prompts: '提示词', stats: '统计', memories: '记忆总览',
26
- lexicon: '词典', help: '帮助',
31
+ logs: '日志', lexicon: '词典', help: '帮助',
27
32
  },
28
33
  en: {
29
- engine: 'Engine & connection', settings: 'Memory settings', folders: 'Folders', libraries: 'Libraries',
34
+ engine: 'Engine & connection', connection: 'Connection & vectors', settings: 'Memory settings', folders: 'Folders', libraries: 'Libraries',
30
35
  browser: 'Memory browser', global: 'Global memory', prompts: 'Prompts', stats: 'Stats', memories: 'Memories',
31
- lexicon: 'Lexicon', help: 'Help',
36
+ logs: 'Logs', lexicon: 'Lexicon', help: 'Help',
32
37
  },
33
38
  }
34
39
  var copy = COPY[locale]
@@ -51,6 +56,8 @@
51
56
  }
52
57
  }
53
58
  applyCopy()
59
+ // 导航装饰文字改走 CSS 变量,随语言切换(见 standalone.css 的 --dshm-studio-label)。
60
+ try { document.documentElement.style.setProperty('--dshm-studio-label', JSON.stringify(copy.studioLabel || '')) } catch (e) {}
54
61
  var root = document.getElementById('root')
55
62
  var boot = document.getElementById('boot')
56
63
  var pageLabel = document.getElementById('pageLabel')
@@ -98,7 +105,7 @@
98
105
  /* ── chrome: page label, title, footer, return control ─────────────────── */
99
106
  function currentSlug() {
100
107
  var match = /^#\/settings\/([a-z]+)/.exec(String(window.location.hash || ''))
101
- return match && PAGE_NAMES[locale][match[1]] ? match[1] : 'memories'
108
+ return match && SETTINGS_PAGES.indexOf(match[1]) >= 0 ? match[1] : 'memories'
102
109
  }
103
110
  function paintLocation() {
104
111
  var slug = currentSlug()
@@ -137,20 +144,31 @@
137
144
  }
138
145
  if (window.opener && !window.opener.closed) {
139
146
  try { window.opener.focus() } catch (e) {}
140
- try { window.close(); return } catch (e) {}
141
147
  }
142
- if (window.history.length > 1) window.history.back()
148
+ // window.close() 对不允许关闭的窗口静默失败且不抛异常,用 window.closed 判定兜底。
149
+ window.close()
150
+ if (!window.closed) window.history.back()
143
151
  })
144
152
 
145
153
  /* ── ambience: pointer spotlight and a shadow once the page scrolls ────── */
146
- if (!reduceMotion && window.matchMedia('(pointer: fine)').matches) {
154
+ // The overlay host embeds this page in an iframe over the whole DSH app.
155
+ // Repainting a full-viewport gradient on every pointer frame forces the host's
156
+ // compositor to keep re-combining that surface, and a maximized window is where
157
+ // WebView2 starts dropping wall tiles. Keep the spotlight for the standalone
158
+ // tab only; the overlay keeps the static ambient layers.
159
+ if (!framed && !reduceMotion && window.matchMedia('(pointer: fine)').matches) {
147
160
  document.body.dataset.pointer = 'fine'
161
+ var spot = document.querySelector('.ambient-spot')
148
162
  var pending = 0
149
163
  window.addEventListener('pointermove', function (event) {
150
164
  if (pending) return
151
165
  pending = window.requestAnimationFrame(function () {
152
166
  pending = 0
153
- var style = document.documentElement.style
167
+ // Scope the variables to the one element that paints the gradient.
168
+ // Writing them on <html> invalidated style for the whole document on
169
+ // every pointer frame — with a long wall of backdrop-filter cards that
170
+ // is enough for WebView2 to drop or flicker compositor frames.
171
+ var style = (spot || document.documentElement).style
154
172
  style.setProperty('--spot-x', event.clientX + 'px')
155
173
  style.setProperty('--spot-y', event.clientY + 'px')
156
174
  })
package/lib/webui.js CHANGED
@@ -26,7 +26,7 @@ export function standaloneAsset(pathname) {
26
26
  }
27
27
 
28
28
  /** The studio stylesheet lives next to this file so it can be read and edited as CSS. */
29
- export function standaloneCss() {
29
+ function standaloneCss() {
30
30
  return fs.readFileSync(path.join(DIR, 'standalone.css'), 'utf8')
31
31
  }
32
32
 
@@ -43,10 +43,10 @@ export function standaloneHtml() {
43
43
  <title>MemU 记忆</title>
44
44
  <meta name="theme-color" content="#f4f5f9">
45
45
  <link rel="icon" href="/dsh-memu-memory/ui-assets/mark.svg" type="image/svg+xml"><link rel="alternate icon" href="/dsh-memu-memory/ui-assets/icon.png">
46
- <script>try{var t=localStorage.getItem('dshm-theme');document.documentElement.dataset.theme=t||(window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light')}catch(e){}</script>
46
+ <script>try{var q=new URLSearchParams(location.search).get('theme');q=(q==='dark'||q==='light')?q:null;var t=localStorage.getItem('dshm-theme');document.documentElement.dataset.theme=t||q||(window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light')}catch(e){}</script>
47
47
  <style>
48
- :root{--dsw-alias-bg-base:#f4f5f9;--dsw-alias-bg-layer-1:#ffffff;--dsw-alias-bg-layer-2:#eceef5;--dsw-alias-bg-layer-3:#e2e5ef;--dsw-alias-bg-layer-4:#d8dce9;--dsw-alias-label-primary:#1a1e2b;--dsw-alias-label-secondary:#5f6577;--dsw-alias-label-primary-inverted:#ffffff;--dsw-alias-border-l1:rgba(26,30,43,.10);--dsw-alias-border-l2:rgba(26,30,43,.18);--dsw-alias-brand-primary:#3b5bdb;--dsw-alias-brand-text:#ffffff;--dsw-alias-label-error:#b43e45;--dsw-alias-label-warning:#9a6b1f}
49
- :root[data-theme=dark]{--dsw-alias-bg-base:#0d0f15;--dsw-alias-bg-layer-1:#171a23;--dsw-alias-bg-layer-2:#1e222d;--dsw-alias-bg-layer-3:#272c39;--dsw-alias-bg-layer-4:#313747;--dsw-alias-label-primary:#e9ebf4;--dsw-alias-label-secondary:#9ba2b5;--dsw-alias-label-primary-inverted:#0b1030;--dsw-alias-border-l1:rgba(233,235,244,.10);--dsw-alias-border-l2:rgba(233,235,244,.18);--dsw-alias-brand-primary:#8ea2ff;--dsw-alias-brand-text:#0b1030;--dsw-alias-label-error:#f08a91;--dsw-alias-label-warning:#d6a45f}
48
+ :root{--dsw-alias-bg-base:#f4f5f9;--dsw-alias-bg-layer-1:#ffffff;--dsw-alias-bg-layer-2:#eceef5;--dsw-alias-bg-layer-3:#e2e5ef;--dsw-alias-bg-layer-4:#d8dce9;--dsw-alias-label-primary:#1a1e2b;--dsw-alias-label-secondary:#5f6577;--dsw-alias-label-primary-inverted:#ffffff;--dsw-alias-border-l1:rgba(26,30,43,.10);--dsw-alias-border-l2:rgba(26,30,43,.18);--dsw-alias-brand-primary:#3b5bdb;--dsw-alias-brand-text:#ffffff;--dsw-alias-label-error:#b43e45;--dsw-alias-label-warning:#9a6b1f;--dsw-alias-state-error-primary:#b43e45;--dsw-alias-state-warn-label:#9a6b1f;--dsw-alias-state-warn-primary:#9a6b1f}
49
+ :root[data-theme=dark]{--dsw-alias-bg-base:#0d0f15;--dsw-alias-bg-layer-1:#171a23;--dsw-alias-bg-layer-2:#1e222d;--dsw-alias-bg-layer-3:#272c39;--dsw-alias-bg-layer-4:#313747;--dsw-alias-label-primary:#e9ebf4;--dsw-alias-label-secondary:#9ba2b5;--dsw-alias-label-primary-inverted:#0b1030;--dsw-alias-border-l1:rgba(233,235,244,.10);--dsw-alias-border-l2:rgba(233,235,244,.18);--dsw-alias-brand-primary:#8ea2ff;--dsw-alias-brand-text:#0b1030;--dsw-alias-label-error:#f08a91;--dsw-alias-label-warning:#d6a45f;--dsw-alias-state-error-primary:#f08a91;--dsw-alias-state-warn-label:#d6a45f;--dsw-alias-state-warn-primary:#d6a45f}
50
50
  ${css}
51
51
  </style>
52
52
  </head>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-memu-memory",
3
3
  "icon": "./assets/icon.png",
4
- "version": "1.2.8",
4
+ "version": "1.3.0",
5
5
  "description": "面向长篇 RP 与陪伴对话的 DeepSeek Harness 记忆插件:三层记忆、逐轮召回、来源标注、关系图、图片附件与独立 WebUI。",
6
6
  "keywords": [
7
7
  "deepseek-harness",
@@ -49,10 +49,11 @@
49
49
  "cordis.patch.yml",
50
50
  "requirements.lock",
51
51
  "README.md",
52
+ "README.zh.md",
53
+ "CHANGELOG.md",
52
54
  "assets",
53
55
  "AGENTS.md",
54
56
  "docs",
55
- "README.zh.md",
56
57
  "LICENSE"
57
58
  ],
58
59
  "scripts": {
@@ -626,7 +626,7 @@ await auto('F-1', 'the engine can be listed, switched and pruned', async () => {
626
626
  await auto('F-2', 'a backup restore brings a deleted memory back', async () => {
627
627
  const lib = makeLibrary('f2')
628
628
  seed(lib.id, 'mem-f2keep', { title: 'written before the backup' })
629
- const made = state.backupDatabases()
629
+ const made = await state.backupDatabases()
630
630
  assert.ok(made, 'a backup was taken')
631
631
  const backups = (await dispatch({}, 'listBackups', {})).backups
632
632
  assert.ok(backups.length >= 1, 'it shows up in the list')
@@ -894,7 +894,7 @@ await auto('H-7', 'an archived memory can be deleted, and only an archived one',
894
894
  await memory.privateArchive({ libraryId: lib.id, id: live.id })
895
895
  const archivedRow = (await dispatch({}, 'browseLibrary', { libraryId: lib.id })).files.find((item) => item.id === live.id)
896
896
  assert.equal(archivedRow.status, 'archived', 'archiving keeps it, so the archived tab has something to show')
897
- const gone = await dispatch({}, 'deleteMemory', { id: live.id, libraryId: lib.id })
897
+ const gone = await dispatch({}, 'deleteMemory', { id: live.id, libraryId: lib.id, confirmed: true })
898
898
  assert.equal(gone.deleted, true)
899
899
  assert.ok(!(await dispatch({}, 'browseLibrary', { libraryId: lib.id })).files.some((item) => item.id === live.id), 'and then it is really gone')
900
900
  let needsLib = ""