dsh-cross-memory 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +1423 -1425
- package/lib/index.js +7 -1
- package/lib/test/client-wiring.test.js +8 -7
- package/lib/test/consolidate-job.test.js +13 -0
- package/lib/test/disputes-panel.test.js +2 -2
- package/lib/test/settings-card.test.js +1 -1
- package/package.json +17 -17
package/lib/index.js
CHANGED
|
@@ -2672,12 +2672,18 @@ export class MemoriesRuntime {
|
|
|
2672
2672
|
enqueueConsolidation(now = Date.now(), readyNow = false, root) {
|
|
2673
2673
|
if (!this.settings.consolidate)
|
|
2674
2674
|
return;
|
|
2675
|
-
const notBefore = readyNow ? now : now + this.settings.consolidateCooldownHours * 3_600_000;
|
|
2676
2675
|
const existing = this.state.getJob(CONSOLIDATE_JOB);
|
|
2677
2676
|
if (existing !== undefined) {
|
|
2677
|
+
// A fresh extraction must NOT push the due time back. Doing so meant an
|
|
2678
|
+
// active store — one that keeps producing memories more often than the
|
|
2679
|
+
// cooldown — never became due at all, so the profile and the merge pass
|
|
2680
|
+
// silently starved. Keep the earliest due time; only a manual enqueue
|
|
2681
|
+
// (`/memories consolidate`) resets it to "now".
|
|
2682
|
+
const notBefore = readyNow ? now : existing.notBefore;
|
|
2678
2683
|
this.state.putJob({ ...existing, enqueuedAt: now, notBefore, ...root === undefined ? {} : { root } });
|
|
2679
2684
|
return;
|
|
2680
2685
|
}
|
|
2686
|
+
const notBefore = readyNow ? now : now + this.settings.consolidateCooldownHours * 3_600_000;
|
|
2681
2687
|
this.state.putJob({ key: CONSOLIDATE_JOB, enqueuedAt: now, notBefore, retries: 0, ...root === undefined ? {} : { root } });
|
|
2682
2688
|
}
|
|
2683
2689
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wiring guard for the browser half's two surfaces.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The compiled browser half (`.client-build/index.js`) is a plain CJS
|
|
5
|
+
* script that the bundle wrapper turns into a DSH client bundle, so there is
|
|
6
|
+
* no module to import: the parts are
|
|
7
|
+
* concatenated here exactly the way `scripts/build-client.mts` concatenates
|
|
7
8
|
* them, and the factory is called for real. What this pins is the registration
|
|
8
9
|
* contract, because nothing else in the suite covers it:
|
|
9
10
|
*
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
* wrong key silently means "no card in the GUI";
|
|
17
18
|
* - both registrations hand the same shared form (`scope` + `useSnapshot`) to
|
|
18
19
|
* their component, so the two editors cannot disagree;
|
|
19
|
-
* - `PACKAGE` is the package name, and `scripts/build-client.
|
|
20
|
+
* - `PACKAGE` is the package name, and `scripts/build-client.mts` uses that
|
|
20
21
|
* same value as the bundle id.
|
|
21
22
|
*
|
|
22
23
|
* @module dsh-cross-memory/test/client-wiring.test
|
|
@@ -25,9 +26,9 @@ import assert from 'node:assert/strict';
|
|
|
25
26
|
import { readFile, readdir } from 'node:fs/promises';
|
|
26
27
|
import test from 'node:test';
|
|
27
28
|
import { REMOTE_INVOCATION_DATA } from '../remote.js';
|
|
28
|
-
/** Where the
|
|
29
|
-
const PARTS = new URL('
|
|
30
|
-
const INDEX = new URL('
|
|
29
|
+
/** Where the compiled browser half lives (emitted from `client/*.ts`). */
|
|
30
|
+
const PARTS = new URL('../../.client-build/parts/', import.meta.url);
|
|
31
|
+
const INDEX = new URL('../../.client-build/index.js', import.meta.url);
|
|
31
32
|
const MANIFEST = new URL('../../package.json', import.meta.url);
|
|
32
33
|
/**
|
|
33
34
|
* Concatenate the browser half the way the bundle script does.
|
|
@@ -60,6 +60,19 @@ test('a later enqueue updates the root so the newest workspace wins', async (t)
|
|
|
60
60
|
runtime.enqueueConsolidation(2_000, false, 'C:\\work\\beta');
|
|
61
61
|
assert.equal(runtime.state.getJob('global')?.root, 'C:\\work\\beta');
|
|
62
62
|
});
|
|
63
|
+
test('a later extraction does not push the due time back', async (t) => {
|
|
64
|
+
const { runtime } = await fixture(t);
|
|
65
|
+
runtime.enqueueConsolidation(1_000, false, 'C:\\work\\alpha');
|
|
66
|
+
const first = runtime.state.getJob('global');
|
|
67
|
+
assert.ok(first !== undefined);
|
|
68
|
+
// An active store keeps producing memories; the second enqueue must not
|
|
69
|
+
// re-arm the cooldown forever (the starvation the profile hit).
|
|
70
|
+
runtime.enqueueConsolidation(1_000 + 3_600_000, false, 'C:\\work\\beta');
|
|
71
|
+
const later = runtime.state.getJob('global');
|
|
72
|
+
assert.equal(later?.notBefore, first.notBefore, 'the due time stays the first one');
|
|
73
|
+
assert.equal(later?.enqueuedAt, first.enqueuedAt + 3_600_000, 'the activity time moves');
|
|
74
|
+
assert.equal(later?.root, 'C:\\work\\beta', 'the newest workspace still wins');
|
|
75
|
+
});
|
|
63
76
|
test('an enqueue without a root keeps the recorded one', async (t) => {
|
|
64
77
|
const { runtime } = await fixture(t);
|
|
65
78
|
runtime.enqueueConsolidation(1_000, false, 'C:\\work\\alpha');
|
|
@@ -30,8 +30,8 @@ const DISPUTES = [{
|
|
|
30
30
|
after: 'what the pass wants instead',
|
|
31
31
|
}];
|
|
32
32
|
/** The browser half, resolved from the compiled test's own location. */
|
|
33
|
-
const SECTION = new URL('
|
|
34
|
-
const REMOTE = new URL('
|
|
33
|
+
const SECTION = new URL('../../.client-build/parts/section.js', import.meta.url);
|
|
34
|
+
const REMOTE = new URL('../../.client-build/parts/remote.js', import.meta.url);
|
|
35
35
|
/** Load the section factory the bundle concatenates. */
|
|
36
36
|
async function loadSection() {
|
|
37
37
|
const source = await readFile(SECTION, 'utf8');
|
|
@@ -15,7 +15,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
15
15
|
import test from 'node:test';
|
|
16
16
|
import { MEMORIES_SETTINGS_DEFAULTS, Config } from '../config.js';
|
|
17
17
|
/** The browser half, resolved from the compiled test's own location. */
|
|
18
|
-
const CARD = new URL('
|
|
18
|
+
const CARD = new URL('../../.client-build/parts/card.js', import.meta.url);
|
|
19
19
|
test('the settings card covers exactly the schema, with bilingual copy', async () => {
|
|
20
20
|
const text = await readFile(CARD, 'utf8');
|
|
21
21
|
const fields = [...text.matchAll(/field: '([A-Za-z][A-Za-z0-9]*)'/gu)].map((match) => match[1]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cross-memory",
|
|
3
3
|
"description": "Cross-session memory for the DeepSeek Harness: project-scoped and global memories with an explicit memory tool, idle-time background extraction, consolidation, and layered summary injection",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -73,24 +73,24 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
|
-
"build": "tsc -p tsconfig.json && node scripts/build-client.
|
|
76
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.client.json && node scripts/build-client.mts",
|
|
77
77
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
78
|
-
"test": "tsc -p tsconfig.json && node scripts/build-client.
|
|
79
|
-
"smoke": "node scripts/activation-smoke.
|
|
80
|
-
"seed": "node scripts/seed.
|
|
81
|
-
"eval": "node scripts/eval-extract.
|
|
82
|
-
"eval:retrieval": "node scripts/eval-retrieval.
|
|
83
|
-
"eval:backfill": "node scripts/eval-backfill.
|
|
84
|
-
"eval:rotation": "node scripts/eval-rotation.
|
|
85
|
-
"eval:coverage-projection": "node scripts/eval-coverage-projection.
|
|
86
|
-
"eval:acceptance": "node scripts/eval-acceptance.
|
|
87
|
-
"eval:recall-log": "node scripts/eval-recall-log.
|
|
88
|
-
"report": "node scripts/report.
|
|
78
|
+
"test": "tsc -p tsconfig.json && tsc -p tsconfig.client.json && node scripts/build-client.mts && node --test lib/test/*.test.js",
|
|
79
|
+
"smoke": "node scripts/activation-smoke.mts .",
|
|
80
|
+
"seed": "node scripts/seed.mts",
|
|
81
|
+
"eval": "node scripts/eval-extract.mts",
|
|
82
|
+
"eval:retrieval": "node scripts/eval-retrieval.mts",
|
|
83
|
+
"eval:backfill": "node scripts/eval-backfill.mts",
|
|
84
|
+
"eval:rotation": "node scripts/eval-rotation.mts",
|
|
85
|
+
"eval:coverage-projection": "node scripts/eval-coverage-projection.mts",
|
|
86
|
+
"eval:acceptance": "node scripts/eval-acceptance.mts",
|
|
87
|
+
"eval:recall-log": "node scripts/eval-recall-log.mts",
|
|
88
|
+
"report": "node scripts/report.mts",
|
|
89
89
|
"prepare": "npm run build",
|
|
90
|
-
"eval:e2e": "node bench/e2e/run.
|
|
91
|
-
"eval:real": "node bench/real/run.
|
|
92
|
-
"eval:real:sample": "node bench/real/sample.
|
|
93
|
-
"eval:real:author": "node bench/real/author.
|
|
90
|
+
"eval:e2e": "node bench/e2e/run.mts",
|
|
91
|
+
"eval:real": "node bench/real/run.mts",
|
|
92
|
+
"eval:real:sample": "node bench/real/sample.mts",
|
|
93
|
+
"eval:real:author": "node bench/real/author.mts"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"@deepseek-ai/cordis": "^4.0.5 || ^4.0.6-alpha.1",
|