dsh-compact-saviour 0.2.8 → 0.2.9
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/README.md +5 -5
- package/lib/client.js +10 -17
- package/lib/client.js.map +1 -1
- package/lib/dsh-compact-saviour.js +6 -12
- package/package.json +22 -21
- package/scripts/link-harness-dependencies.mjs +22 -6
- package/tests/peer-range.test.ts +8 -8
|
@@ -5,7 +5,7 @@ import { SessionId, SessionSeq } from "@deepseek-ai/dsh-session";
|
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { isDeepStrictEqual } from "node:util";
|
|
7
7
|
import { CompactionId, ManualCompactionError, compactCheckpointSource, toolPairingBalancedAfter, toolPairingBalancedBefore } from "@deepseek-ai/dsh-compaction";
|
|
8
|
-
|
|
8
|
+
// lib/types/summary-types.js
|
|
9
9
|
function frameSummary(summary) {
|
|
10
10
|
return [
|
|
11
11
|
{
|
|
@@ -19,8 +19,7 @@ function frameSummary(summary) {
|
|
|
19
19
|
}
|
|
20
20
|
];
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//#region lib/types/vendor/region.js
|
|
22
|
+
// lib/types/vendor/region.js
|
|
24
23
|
/**
|
|
25
24
|
* Surface retention selection and the shared log-recorded compaction
|
|
26
25
|
* transaction for automatic open-turn and manual idle-session compaction.
|
|
@@ -636,8 +635,7 @@ async function compress(ctx, input, agent, options) {
|
|
|
636
635
|
maxTokens: cap
|
|
637
636
|
};
|
|
638
637
|
}
|
|
639
|
-
|
|
640
|
-
//#region lib/types/pressure.js
|
|
638
|
+
// lib/types/pressure.js
|
|
641
639
|
function estimateRequest(measurement, header) {
|
|
642
640
|
return measurement.surfaceTokens + (header?.tools?.length ? Math.ceil(JSON.stringify(header.tools).length / 4) + 4 : 0);
|
|
643
641
|
}
|
|
@@ -725,8 +723,7 @@ var PressureMeter = class {
|
|
|
725
723
|
};
|
|
726
724
|
}
|
|
727
725
|
};
|
|
728
|
-
|
|
729
|
-
//#region lib/types/controller.js
|
|
726
|
+
// lib/types/controller.js
|
|
730
727
|
const inactive = () => ({
|
|
731
728
|
view: {
|
|
732
729
|
phase: "idle",
|
|
@@ -1112,8 +1109,7 @@ var Controller = class {
|
|
|
1112
1109
|
return work;
|
|
1113
1110
|
}
|
|
1114
1111
|
};
|
|
1115
|
-
|
|
1116
|
-
//#region lib/types/routes.js
|
|
1112
|
+
// lib/types/routes.js
|
|
1117
1113
|
function snapshot(value) {
|
|
1118
1114
|
if (!value.revision || ![value.context, value.target].every((route) => typeof route?.provider === "string" && route.provider && typeof route.model === "string" && route.model && (route.reasoningEffort === void 0 || typeof route.reasoningEffort === "string" && route.reasoningEffort))) throw new Error("Invalid session compaction route");
|
|
1119
1115
|
if (value.maxOutputTokens !== void 0 && (!Number.isSafeInteger(value.maxOutputTokens) || value.maxOutputTokens <= 0)) throw new Error("Invalid session compaction output reservation");
|
|
@@ -1185,8 +1181,7 @@ var CompactionRouteRegistry = class {
|
|
|
1185
1181
|
this.resolvers.clear();
|
|
1186
1182
|
}
|
|
1187
1183
|
};
|
|
1188
|
-
|
|
1189
|
-
//#region lib/types/dsh-compact-saviour.js
|
|
1184
|
+
// lib/types/dsh-compact-saviour.js
|
|
1190
1185
|
const name = "dsh-compact-saviour";
|
|
1191
1186
|
const inject = [
|
|
1192
1187
|
"agents",
|
|
@@ -1313,5 +1308,4 @@ function apply(ctx, config) {
|
|
|
1313
1308
|
}));
|
|
1314
1309
|
ctx.logger.info("[my-plugins/dsh-compact-saviour] loaded");
|
|
1315
1310
|
}
|
|
1316
|
-
//#endregion
|
|
1317
1311
|
export { CompactionRouteRegistry, Config, apply, inject, name };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-compact-saviour",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Dedicated-model compaction rescue and manual compaction in the native context popup",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,25 +39,25 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
41
41
|
"@deepseek-ai/schemastery": "^3.18.4",
|
|
42
|
-
"@deepseek-ai/dsh-agent": ">=0.2.
|
|
43
|
-
"@deepseek-ai/dsh-compaction": ">=0.2.
|
|
44
|
-
"@deepseek-ai/dsh-compaction-basic": ">=0.2.
|
|
45
|
-
"@deepseek-ai/dsh-commands": ">=0.2.
|
|
46
|
-
"@deepseek-ai/dsh-llm": ">=0.2.
|
|
47
|
-
"@deepseek-ai/dsh-session": ">=0.2.
|
|
48
|
-
"@deepseek-ai/dsh-token-meter": ">=0.2.
|
|
49
|
-
"@deepseek-ai/dsh-settings": ">=0.2.
|
|
50
|
-
"@deepseek-ai/dsh-scope": ">=0.2.
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.
|
|
52
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.
|
|
53
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.
|
|
54
|
-
"@deepseek-ai/dsh-api-session-controller": ">=0.2.
|
|
42
|
+
"@deepseek-ai/dsh-agent": ">=0.2.1-rc.1 <0.2.2",
|
|
43
|
+
"@deepseek-ai/dsh-compaction": ">=0.2.1-rc.1 <0.2.2",
|
|
44
|
+
"@deepseek-ai/dsh-compaction-basic": ">=0.2.1-rc.1 <0.2.2",
|
|
45
|
+
"@deepseek-ai/dsh-commands": ">=0.2.1-rc.1 <0.2.2",
|
|
46
|
+
"@deepseek-ai/dsh-llm": ">=0.2.1-rc.1 <0.2.2",
|
|
47
|
+
"@deepseek-ai/dsh-session": ">=0.2.1-rc.1 <0.2.2",
|
|
48
|
+
"@deepseek-ai/dsh-token-meter": ">=0.2.1-rc.1 <0.2.2",
|
|
49
|
+
"@deepseek-ai/dsh-settings": ">=0.2.1-rc.1 <0.2.2",
|
|
50
|
+
"@deepseek-ai/dsh-scope": ">=0.2.1-rc.1 <0.2.2",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.1-rc.1 <0.2.2",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.1-rc.1 <0.2.2",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.1-rc.1 <0.2.2",
|
|
54
|
+
"@deepseek-ai/dsh-api-session-controller": ">=0.2.1-rc.1 <0.2.2",
|
|
55
55
|
"react": "^18.2.0",
|
|
56
56
|
"react-dom": "^18.2.0",
|
|
57
|
-
"@deepseek-ai/dsh-client-connection": ">=0.2.
|
|
58
|
-
"@deepseek-ai/dsh-host-webserver": ">=0.2.
|
|
59
|
-
"@deepseek-ai/dsh-session-projection": ">=0.2.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.
|
|
57
|
+
"@deepseek-ai/dsh-client-connection": ">=0.2.1-rc.1 <0.2.2",
|
|
58
|
+
"@deepseek-ai/dsh-host-webserver": ">=0.2.1-rc.1 <0.2.2",
|
|
59
|
+
"@deepseek-ai/dsh-session-projection": ">=0.2.1-rc.1 <0.2.2",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.1-rc.1 <0.2.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "^22.20.0",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"typescript": "^6.0.3",
|
|
67
67
|
"tsx": "^4.22.4",
|
|
68
68
|
"tsdown": "^0.22.2",
|
|
69
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.
|
|
70
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
69
|
+
"@deepseek-ai/dsh-agent-loop-testkit": ">=0.2.1-rc.1 <0.2.2",
|
|
70
|
+
"@deepseek-ai/dsh-agent-loop": ">=0.2.1-rc.1 <0.2.2",
|
|
71
71
|
"semver": "7.8.5",
|
|
72
72
|
"@deepseek-ai/cordis-plugin-loader": "*"
|
|
73
73
|
},
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"docs"
|
|
89
89
|
],
|
|
90
90
|
"engines": {
|
|
91
|
-
"node": ">=24.0.0"
|
|
91
|
+
"node": ">=24.0.0",
|
|
92
|
+
"dsh": ">=0.2.1-rc.1 <0.2.2"
|
|
92
93
|
},
|
|
93
94
|
"repository": {
|
|
94
95
|
"type": "git",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { existsSync, mkdirSync,
|
|
1
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, symlinkSync } from 'node:fs';
|
|
2
2
|
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
|
-
const root = resolve(process.argv[2] || '');
|
|
5
|
-
if (!
|
|
4
|
+
const root = resolve(process.argv[2] || process.env.DSH_REPO || '');
|
|
5
|
+
if (!root || !existsSync(join(root, 'tools/dshx/src/client-build.js'))) throw new Error('Pass a prepared Harness checkout.');
|
|
6
6
|
const packages = new Map();
|
|
7
7
|
function walk(path, depth = 0) {
|
|
8
8
|
if (depth > 4) return;
|
|
@@ -18,8 +18,18 @@ function link(name, target) {
|
|
|
18
18
|
const destination = join(local, name);
|
|
19
19
|
mkdirSync(dirname(destination), { recursive: true });
|
|
20
20
|
if (existsSync(destination)) {
|
|
21
|
-
if (realpathSync(destination)
|
|
22
|
-
|
|
21
|
+
if (realpathSync(destination) === realpathSync(target)) return;
|
|
22
|
+
if (!lstatSync(destination).isSymbolicLink()) {
|
|
23
|
+
if (!name.startsWith('@deepseek-ai/')) {
|
|
24
|
+
console.log(`Keeping installed ${name}; it is not a symlink.`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
rmSync(destination, { recursive: true, force: true });
|
|
28
|
+
} else {
|
|
29
|
+
rmSync(destination);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
symlinkSync(target, destination);
|
|
23
33
|
}
|
|
24
34
|
const rootRequire = createRequire(join(root, 'package.json'));
|
|
25
35
|
const uiRequire = createRequire(join(root, 'packages/client/ui-conversation/package.json'));
|
|
@@ -30,7 +40,13 @@ for (const name of Object.keys({ ...pkg.peerDependencies, ...pkg.devDependencies
|
|
|
30
40
|
if (!target) for (const req of [rootRequire, uiRequire, webRequire]) {
|
|
31
41
|
try { target = dirname(req.resolve(`${name}/package.json`)); break; } catch {}
|
|
32
42
|
}
|
|
33
|
-
if (!target)
|
|
43
|
+
if (!target) {
|
|
44
|
+
if (existsSync(join(local, name))) {
|
|
45
|
+
console.log(`Keeping installed ${name}; selected Harness does not ship it.`);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Cannot resolve ${name} in selected Harness`);
|
|
49
|
+
}
|
|
34
50
|
link(name, target);
|
|
35
51
|
}
|
|
36
52
|
mkdirSync(join(local, '.bin'), { recursive: true });
|
package/tests/peer-range.test.ts
CHANGED
|
@@ -3,19 +3,19 @@ import { readFileSync } from 'node:fs';
|
|
|
3
3
|
import test from 'node:test';
|
|
4
4
|
import semver from 'semver';
|
|
5
5
|
|
|
6
|
-
const RANGE = '>=0.2.
|
|
7
|
-
const ACCEPT = ['0.2.
|
|
8
|
-
const REJECT = ['0.2.0-alpha', '0.2.0-alpha.1', '0.2.
|
|
6
|
+
const RANGE = '>=0.2.1-rc.1 <0.2.2';
|
|
7
|
+
const ACCEPT = ['0.2.1-rc.5', '0.2.1-rc.1', '0.2.1'];
|
|
8
|
+
const REJECT = ['0.2.0-rc.2', '0.2.0', '0.2.0-alpha', '0.2.0-alpha.1', '0.2.1-alpha.1', '0.1.7-rc.2', '0.1.7-rc.1', '0.2.2'];
|
|
9
9
|
|
|
10
|
-
test('Harness peers use >=0.2.
|
|
10
|
+
test('Harness peers use >=0.2.1-rc.1 <0.2.2', () => {
|
|
11
11
|
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
12
|
-
assert.equal(pkg.version, '0.2.
|
|
13
|
-
assert.equal(semver.satisfies('0.2.
|
|
12
|
+
assert.equal(pkg.version, '0.2.9');
|
|
13
|
+
assert.equal(semver.satisfies('0.2.1-rc.5', RANGE), true);
|
|
14
14
|
const peers = Object.entries(pkg.peerDependencies).filter(([name]) => name.startsWith('@deepseek-ai/dsh'));
|
|
15
15
|
assert.ok(peers.length >= 17);
|
|
16
16
|
for (const [name, range] of peers) assert.equal(range, RANGE, name);
|
|
17
|
-
assert.equal(pkg.devDependencies['@deepseek-ai/dsh-agent-loop'],
|
|
18
|
-
assert.equal(pkg.devDependencies['@deepseek-ai/dsh-agent-loop-testkit'],
|
|
17
|
+
assert.equal(pkg.devDependencies['@deepseek-ai/dsh-agent-loop'], RANGE);
|
|
18
|
+
assert.equal(pkg.devDependencies['@deepseek-ai/dsh-agent-loop-testkit'], RANGE);
|
|
19
19
|
assert.equal(pkg.peerDependencies['@deepseek-ai/cordis'], '^4.0.4');
|
|
20
20
|
assert.equal(pkg.peerDependencies['@deepseek-ai/schemastery'], '^3.18.4');
|
|
21
21
|
for (const version of ACCEPT) assert.equal(semver.satisfies(version, RANGE), true, version);
|