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.
- package/CHANGELOG.md +494 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/docs/memory-semantics.md +3 -2
- package/lib/backup.js +154 -25
- package/lib/binding-diagnostics.js +2 -3
- package/lib/budget.js +0 -9
- package/lib/client.js +221 -128
- package/lib/commitment.js +3 -3
- package/lib/consolidation-ledger.js +46 -3
- package/lib/consolidation-receipt.js +41 -16
- package/lib/consolidation-worker.js +34 -10
- package/lib/curator-policy.js +23 -0
- package/lib/cycle.js +8 -4
- package/lib/embedding-download.js +168 -28
- package/lib/embedding-runtime.js +76 -17
- package/lib/engine.js +0 -6
- package/lib/freshness.js +2 -2
- package/lib/graph.js +139 -11
- package/lib/index.js +71 -20
- package/lib/inject.js +50 -7
- package/lib/lexicon.js +61 -16
- package/lib/local-vector-service.js +21 -1
- package/lib/media.js +49 -12
- package/lib/memory.js +662 -116
- package/lib/paths.js +0 -7
- package/lib/preset-scope.js +6 -1
- package/lib/private.js +281 -18
- package/lib/prompts/private-consolidation.md +2 -2
- package/lib/prompts/private-consolidation.rp.md +3 -2
- package/lib/prompts.js +0 -7
- package/lib/rpc.js +95 -17
- package/lib/snippet.js +18 -2
- package/lib/state.js +109 -30
- package/lib/stats.js +2 -2
- package/lib/temporal.js +19 -0
- package/lib/text-retrieval.js +120 -44
- package/lib/text-similarity.js +205 -24
- package/lib/tokenizer-v2.js +0 -24
- package/lib/tools.js +62 -62
- package/lib/vector-migration.js +15 -0
- package/lib/vector-profile.js +81 -8
- package/lib/visibility.js +0 -4
- package/lib/webui/standalone.css +17 -22
- package/lib/webui/standalone.js +27 -9
- package/lib/webui.js +4 -4
- package/package.json +3 -2
- package/scripts/acceptance-local.mjs +2 -2
- package/scripts/check-all.mjs +3 -1
- package/scripts/check-i18n.mjs +35 -1
- package/scripts/migrate-visibility.mjs +3 -3
- package/scripts/prune-sessions.mjs +34 -0
- package/scripts/prune-vectors.mjs +24 -0
- package/tests/appendix-b.test.mjs +5 -4
- package/tests/audit-batch3.test.mjs +247 -0
- package/tests/audit-regression.test.mjs +2 -2
- package/tests/backup.test.mjs +83 -83
- package/tests/browser.test.mjs +6 -1
- package/tests/client-render.test.mjs +2 -2
- package/tests/consolidation-fork.test.mjs +61 -15
- package/tests/consolidation-ledger.test.mjs +64 -3
- package/tests/consolidation-snapshot.test.mjs +25 -9
- package/tests/curator-clusters.test.mjs +18 -0
- package/tests/curator-pairing.test.mjs +59 -16
- package/tests/dynamic-rrf.test.mjs +22 -19
- package/tests/dynamic-threshold.test.mjs +52 -0
- package/tests/fact-version.test.mjs +18 -0
- package/tests/fixtures/tokenizer-cases.mjs +27 -0
- package/tests/graph-cascade.test.mjs +29 -0
- package/tests/graph.test.mjs +45 -0
- package/tests/inject-conflict.test.mjs +18 -0
- package/tests/injection-chain.test.mjs +2 -2
- package/tests/lexical-bm25.test.mjs +171 -0
- package/tests/lexicon-frequency.test.mjs +16 -0
- package/tests/lexicon-inject.test.mjs +21 -0
- package/tests/lexicon-perf.test.mjs +37 -9
- package/tests/lexicon-scope.test.mjs +2 -2
- package/tests/lexicon-ui.test.mjs +1 -1
- package/tests/managed-memory.test.mjs +19 -0
- package/tests/ops-hardening.test.mjs +209 -0
- package/tests/package-shipping.test.mjs +4 -0
- package/tests/prompt-semantics.test.mjs +1 -1
- package/tests/prompts.test.mjs +1 -1
- package/tests/recall-intent.test.mjs +23 -0
- package/tests/slot-similarity.test.mjs +153 -0
- package/tests/state-gc.test.mjs +34 -0
- package/tests/state.test.mjs +2 -2
- package/tests/tokenizer-v2.test.mjs +1 -1
- package/tests/vector-gc.test.mjs +37 -0
- 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
|
|
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
|
|
273
|
-
title: { type: 'string', description: '8-40
|
|
274
|
-
layer: { type: 'string', description: 'long_term (default), short_term,
|
|
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
|
|
279
|
-
conflicts_with: { type: 'string', description: '
|
|
280
|
-
supersedes: { type: 'string', description: '
|
|
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: '
|
|
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: '
|
|
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,
|
|
297
|
-
owner: { type: 'string', description: 'me, us, about_user,
|
|
298
|
-
visibility: { type: 'string', description: 'shared (default
|
|
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: '
|
|
301
|
+
description: 'inferred (default), user_said (quotable), assistant_said, imagined, told, tool.',
|
|
302
302
|
},
|
|
303
|
-
source_kind: { type: 'string', description: '
|
|
304
|
-
speaker_id: { type: 'string', description: '
|
|
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
|
|
309
|
+
description: 'Optional source pointer; do not paste the whole quote.',
|
|
310
310
|
},
|
|
311
|
-
storyline_id: { type: 'string', description: 'Optional storyline
|
|
312
|
-
branch_id: { type: 'string', description: 'Optional branch id
|
|
313
|
-
known_by: { type: 'array', items: { type: 'string' }, description: 'Character
|
|
314
|
-
confidence: { type: 'number', description: '0-1
|
|
315
|
-
mood_valence: { type: 'number', description: '
|
|
316
|
-
arousal: { type: 'number', description: '
|
|
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: '
|
|
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: '
|
|
325
|
-
peak: { type: 'boolean', description: '
|
|
326
|
-
allow_duplicate: { type: 'boolean', description: 'Only for
|
|
327
|
-
salient_date: { type: 'string', description: 'MM-DD for
|
|
328
|
-
observed_at: { type: 'string', description: 'ISO
|
|
329
|
-
absolute_date: { type: 'string', description: 'YYYY-MM-DD this
|
|
330
|
-
valid_from: { type: 'string', description: 'Optional YYYY-MM-DD
|
|
331
|
-
valid_to: { type: 'string', description: 'Optional YYYY-MM-DD after which
|
|
332
|
-
date_precision: { type: 'string', description: 'day
|
|
333
|
-
track: { type: 'string', description: 'memory (default) or habit
|
|
334
|
-
attachments: { type: 'array', items: { type: 'object', properties: { sha256: { type: 'string', required: true } }, additionalProperties: true }, description: 'At most 8 sha256
|
|
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;
|
|
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
|
|
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: '
|
|
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,
|
|
472
|
-
layer: { type: 'string', description: 'long_term
|
|
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
|
|
485
|
+
description: 'Replace commitment; status=done/cancelled/expired closes it.',
|
|
486
486
|
},
|
|
487
|
-
disclosure: { type: 'string', description: 'can_tell, only_if_asked,
|
|
488
|
-
owner: { type: 'string', description: 'me, us, about_user,
|
|
489
|
-
visibility: { type: 'string', description: 'shared or secret.
|
|
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,
|
|
495
|
-
source_kind: { type: 'string', description: 'Same values as source;
|
|
496
|
-
speaker_id: { type: 'string', description: '
|
|
497
|
-
quote_span: { type: 'object', properties: { seq: { type: 'integer' }, turn: { type: 'integer' }, textHash: { type: 'string' } }, additionalProperties: false, description: '
|
|
498
|
-
storyline_id: { type: 'string', description: 'Storyline
|
|
499
|
-
branch_id: { type: 'string', description: 'Branch id; empty
|
|
500
|
-
known_by: { type: 'array', items: { type: 'string' }, description: 'Character
|
|
501
|
-
track: { type: 'string', description: 'memory or habit.
|
|
502
|
-
peak: { type: 'boolean', description: 'Flashbulb flag
|
|
503
|
-
mood_valence: { type: 'number', description: '
|
|
504
|
-
arousal: { type: 'number', description: '
|
|
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: '
|
|
509
|
+
description: 'Omit keeps; null clears; object replaces after normalisation. Event feeling, not current mood.',
|
|
510
510
|
},
|
|
511
|
-
dominance: { type: 'number', description: '
|
|
512
|
-
salient_date: { type: 'string', description: '
|
|
513
|
-
observed_at: { type: 'string', description: 'ISO scene time for this edit;
|
|
514
|
-
absolute_date: { type: 'string', description: 'YYYY-MM-DD
|
|
515
|
-
valid_from: { type: 'string', description: 'YYYY-MM-DD
|
|
516
|
-
valid_to: { type: 'string', description: 'YYYY-MM-DD
|
|
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({
|
package/lib/vector-migration.js
CHANGED
|
@@ -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 }
|
package/lib/vector-profile.js
CHANGED
|
@@ -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
|
}
|
package/lib/webui/standalone.css
CHANGED
|
@@ -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
|
-
/*
|
|
623
|
-
|
|
624
|
-
|
|
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(--
|
|
926
|
-
background: color-mix(in srgb, var(--
|
|
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, .
|
|
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; }
|
package/lib/webui/standalone.js
CHANGED
|
@@ -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 &&
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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 = ""
|