dsh-context-compression-improved 0.6.4 → 0.7.0-beta.1
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.ja.md +51 -0
- package/CHANGELOG.ko.md +47 -0
- package/CHANGELOG.md +72 -0
- package/CHANGELOG.zh.md +47 -0
- package/README.ja.md +2 -2
- package/README.ko.md +2 -2
- package/README.md +6 -3
- package/README.zh.md +3 -2
- package/eslint.config.js +76 -30
- package/package.json +164 -162
- package/packages/selector/dsh.plugin.json +16 -16
- package/packages/selector/lib/client.js +16 -4
- package/packages/selector/lib/index.js +92 -1
- package/packages/selector/lib/{advisor-state.js → intent-gate.js} +91 -3
- package/packages/selector/lib/profiles.d.ts +9 -0
- package/packages/selector/lib/pruner.d.ts +59 -0
- package/packages/selector/lib/pruner.js +410 -8
- package/packages/selector/package.json +114 -114
- package/packages/selector/src/client/decode.ts +6 -2
- package/packages/selector/src/client/index.ts +213 -232
- package/packages/selector/src/client/scope-face.ts +24 -24
- package/packages/selector/src/deepseek-v4-tokenizer.ts +1 -1
- package/packages/selector/src/index.ts +418 -412
- package/packages/selector/src/preset-overlay.ts +3 -0
- package/packages/selector/src/profiles.ts +30 -10
- package/packages/selector/src/pruner/content.ts +1 -1
- package/packages/selector/src/pruner/state.ts +7 -0
- package/packages/selector/src/pruner.ts +253 -10
- package/packages/selector/src/runtime/audit.ts +17 -0
- package/packages/selector/src/runtime/config.ts +36 -11
- package/packages/selector/src/runtime/reducers.ts +1 -1
- package/packages/selector/src/runtime/summary-command.ts +133 -0
- package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +46 -1
- package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +55 -0
- package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
- package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
- package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
- package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
- package/packages/selector/src/runtime/tokenpilot/locator.ts +2 -2
- package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +4 -1
- package/packages/selector/src/runtime/types.ts +12 -0
- package/packages/selector/tests/auto-compact.client.spec.tsx +214 -213
- package/packages/selector/tests/built/client-artifact.spec.ts +2 -0
- package/packages/selector/tests/code-skeleton.client.spec.ts +94 -93
- package/packages/selector/tests/custom-contract.client.spec.ts +3 -2
- package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
- package/packages/selector/tests/helpers/legacy-namespace.ts +8 -4
- package/packages/selector/tests/helpers/legacy-settings/index.ts +15 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +41 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +647 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +78 -0
- package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +234 -0
- package/packages/selector/tests/host-preset-overlay.host.spec.ts +204 -206
- package/packages/selector/tests/preset-options-write.client.spec.ts +188 -187
- package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +200 -206
- package/packages/selector/tests/profiles.client.spec.tsx +436 -434
- package/packages/selector/tests/public/package-contract.client.spec.ts +78 -78
- package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +230 -233
- package/packages/selector/tests/runtime/audit.spec.ts +275 -274
- package/packages/selector/tests/runtime/auto-compact-config.spec.ts +3 -3
- package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +4 -4
- package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
- package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
- package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2736 -2727
- package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
- package/packages/selector/tests/settings-seat.client.spec.ts +165 -165
- package/packages/selector/tests/standing-generation.host.spec.ts +704 -704
- package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +18 -2
- package/packages/selector/tests/support/ui-primitives.tsx +34 -34
- package/pnpm-workspace.yaml +1 -1
- package/scripts/packed-components-smoke.mjs +2 -0
- package/scripts/packed-install-e2e.mjs +1275 -1273
- package/scripts/verify-release.mjs +318 -317
- package/tsconfig.tests.json +3 -1
- package/vitest.config.ts +14 -0
package/package.json
CHANGED
|
@@ -1,162 +1,164 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-context-compression-improved",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"tag": "dsh-0.1.7"
|
|
6
|
-
},
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "packages/selector/lib/index.js",
|
|
9
|
-
"types": "packages/selector/lib/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./packages/selector/lib/index.d.ts",
|
|
13
|
-
"default": "./packages/selector/lib/index.js"
|
|
14
|
-
},
|
|
15
|
-
"./invariant": {
|
|
16
|
-
"types": "./packages/selector/lib/invariant.d.ts",
|
|
17
|
-
"default": "./packages/selector/lib/invariant.js"
|
|
18
|
-
},
|
|
19
|
-
"./pruner": {
|
|
20
|
-
"types": "./packages/selector/lib/pruner.d.ts",
|
|
21
|
-
"default": "./packages/selector/lib/pruner.js"
|
|
22
|
-
},
|
|
23
|
-
"./client": {
|
|
24
|
-
"types": "./packages/selector/lib/client.d.ts",
|
|
25
|
-
"default": "./packages/selector/lib/client.js"
|
|
26
|
-
},
|
|
27
|
-
"./package.json": "./package.json"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@deepseek-ai/schemastery": "3.18.4",
|
|
31
|
-
"@huggingface/tokenizers": "0.1.3",
|
|
32
|
-
"js-yaml": "^4.3.2"
|
|
33
|
-
},
|
|
34
|
-
"dsh": {
|
|
35
|
-
"client": {
|
|
36
|
-
"inject": [
|
|
37
|
-
"@deepseek-ai/dsh-client-locale",
|
|
38
|
-
"@deepseek-ai/dsh-client-ui-primitives",
|
|
39
|
-
"@deepseek-ai/dsh-client-ui-slots",
|
|
40
|
-
"@deepseek-ai/dsh-client-ui-settings"
|
|
41
|
-
],
|
|
42
|
-
"platform": "web"
|
|
43
|
-
},
|
|
44
|
-
"bundle": {
|
|
45
|
-
"patch": "./packages/selector/cordis.patch.yml"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"license": "MIT",
|
|
49
|
-
"repository": {
|
|
50
|
-
"type": "git",
|
|
51
|
-
"url": "git+https://github.com/drscrewdriver/dsh-context-compression-improved.git"
|
|
52
|
-
},
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"@deepseek-ai/dsh-client-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"@deepseek-ai/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"@deepseek-ai/dsh-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"@deepseek-ai/dsh-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"@deepseek-ai/dsh-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"@deepseek-ai/
|
|
94
|
-
"@deepseek-ai/
|
|
95
|
-
"@deepseek-ai/
|
|
96
|
-
"@deepseek-ai/
|
|
97
|
-
"@deepseek-ai/dsh-
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-
|
|
100
|
-
"@deepseek-ai/dsh-
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/dsh-
|
|
103
|
-
"@deepseek-ai/dsh-
|
|
104
|
-
"@deepseek-ai/dsh-
|
|
105
|
-
"@deepseek-ai/dsh-
|
|
106
|
-
"@deepseek-ai/dsh-
|
|
107
|
-
"@deepseek-ai/dsh-
|
|
108
|
-
"@deepseek-ai/dsh-
|
|
109
|
-
"@deepseek-ai/dsh-
|
|
110
|
-
"@deepseek-ai/dsh-
|
|
111
|
-
"@deepseek-ai/dsh-
|
|
112
|
-
"@deepseek-ai/dsh-
|
|
113
|
-
"@deepseek-ai/dsh-
|
|
114
|
-
"@deepseek-ai/dsh-
|
|
115
|
-
"@deepseek-ai/dsh-
|
|
116
|
-
"@deepseek-ai/dsh-
|
|
117
|
-
"@deepseek-ai/dsh-
|
|
118
|
-
"@deepseek-ai/dsh-
|
|
119
|
-
"@deepseek-ai/dsh-
|
|
120
|
-
"@deepseek-ai/dsh-
|
|
121
|
-
"@deepseek-ai/dsh-
|
|
122
|
-
"@deepseek-ai/dsh-
|
|
123
|
-
"@deepseek-ai/dsh-
|
|
124
|
-
"@deepseek-ai/dsh-
|
|
125
|
-
"@deepseek-ai/dsh-
|
|
126
|
-
"@deepseek-ai/dsh-
|
|
127
|
-
"@deepseek-ai/dsh-
|
|
128
|
-
"@deepseek-ai/dsh-
|
|
129
|
-
"@deepseek-ai/dsh-
|
|
130
|
-
"@deepseek-ai/
|
|
131
|
-
"@
|
|
132
|
-
"@
|
|
133
|
-
"@
|
|
134
|
-
"@
|
|
135
|
-
"@
|
|
136
|
-
"@
|
|
137
|
-
"@
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
|
|
162
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-context-compression-improved",
|
|
3
|
+
"version": "0.7.0-beta.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"tag": "dsh-0.1.7"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "packages/selector/lib/index.js",
|
|
9
|
+
"types": "packages/selector/lib/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./packages/selector/lib/index.d.ts",
|
|
13
|
+
"default": "./packages/selector/lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./invariant": {
|
|
16
|
+
"types": "./packages/selector/lib/invariant.d.ts",
|
|
17
|
+
"default": "./packages/selector/lib/invariant.js"
|
|
18
|
+
},
|
|
19
|
+
"./pruner": {
|
|
20
|
+
"types": "./packages/selector/lib/pruner.d.ts",
|
|
21
|
+
"default": "./packages/selector/lib/pruner.js"
|
|
22
|
+
},
|
|
23
|
+
"./client": {
|
|
24
|
+
"types": "./packages/selector/lib/client.d.ts",
|
|
25
|
+
"default": "./packages/selector/lib/client.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
31
|
+
"@huggingface/tokenizers": "0.1.3",
|
|
32
|
+
"js-yaml": "^4.3.2"
|
|
33
|
+
},
|
|
34
|
+
"dsh": {
|
|
35
|
+
"client": {
|
|
36
|
+
"inject": [
|
|
37
|
+
"@deepseek-ai/dsh-client-locale",
|
|
38
|
+
"@deepseek-ai/dsh-client-ui-primitives",
|
|
39
|
+
"@deepseek-ai/dsh-client-ui-slots",
|
|
40
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
41
|
+
],
|
|
42
|
+
"platform": "web"
|
|
43
|
+
},
|
|
44
|
+
"bundle": {
|
|
45
|
+
"patch": "./packages/selector/cordis.patch.yml"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/drscrewdriver/dsh-context-compression-improved.git"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": "^22.19.0 || >=24.0.0",
|
|
55
|
+
"dsh": ">=0.1.7-rc.1 <0.1.8-0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.1.8-0",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.1.7-rc.1 <0.1.8-0",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.1.8-0",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.1.8-0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"@deepseek-ai/dsh-client-locale": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-primitives": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-settings": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@deepseek-ai/cordis": "4.0.1",
|
|
79
|
+
"@deepseek-ai/cordis-plugin-group": "1.0.1",
|
|
80
|
+
"@deepseek-ai/cordis-plugin-include": "1.0.6",
|
|
81
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.2",
|
|
82
|
+
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
|
|
84
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.2",
|
|
85
|
+
"@deepseek-ai/dsh-agent-presets": "0.1.6-alpha.2",
|
|
86
|
+
"@deepseek-ai/dsh-anonymous-user-id": "0.1.7-rc.2",
|
|
87
|
+
"@deepseek-ai/dsh-api-remotes": "0.1.7-rc.2",
|
|
88
|
+
"@deepseek-ai/dsh-api-session-controller": "0.1.7-rc.2",
|
|
89
|
+
"@deepseek-ai/dsh-atomic-write": "0.1.7-rc.2",
|
|
90
|
+
"@deepseek-ai/dsh-attachment": "0.1.7-rc.2",
|
|
91
|
+
"@deepseek-ai/dsh-client-locale": "0.1.7-rc.2",
|
|
92
|
+
"@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-session": "0.1.7-rc.2",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.2",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-workspace": "0.1.7-rc.2",
|
|
98
|
+
"@deepseek-ai/dsh-code-runtime": "0.1.5-rc.3",
|
|
99
|
+
"@deepseek-ai/dsh-command-compact": "0.1.7-rc.2",
|
|
100
|
+
"@deepseek-ai/dsh-commands": "0.1.7-rc.2",
|
|
101
|
+
"@deepseek-ai/dsh-compaction": "0.1.7-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-compaction-basic": "0.1.7-rc.2",
|
|
103
|
+
"@deepseek-ai/dsh-cordis-host-runner": "0.1.7-rc.2",
|
|
104
|
+
"@deepseek-ai/dsh-credentials": "0.1.7-rc.2",
|
|
105
|
+
"@deepseek-ai/dsh-goal": "0.1.7-rc.2",
|
|
106
|
+
"@deepseek-ai/dsh-home-paths": "0.1.7-rc.2",
|
|
107
|
+
"@deepseek-ai/dsh-host-plugin-inventory": "0.1.7-rc.2",
|
|
108
|
+
"@deepseek-ai/dsh-invariants": "0.1.7-rc.2",
|
|
109
|
+
"@deepseek-ai/dsh-jobs": "0.1.7-rc.2",
|
|
110
|
+
"@deepseek-ai/dsh-launch-environment": "0.1.7-rc.2",
|
|
111
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
112
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
|
|
113
|
+
"@deepseek-ai/dsh-llm-retry": "0.1.7-rc.2",
|
|
114
|
+
"@deepseek-ai/dsh-message-feedback": "0.1.7-rc.2",
|
|
115
|
+
"@deepseek-ai/dsh-sandbox": "0.1.7-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-scope": "0.1.7-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.7-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-session-projection": "0.1.7-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-settings": "0.1.7-rc.2",
|
|
121
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
122
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-rc.2",
|
|
123
|
+
"@deepseek-ai/dsh-subagent-in-process-driver": "0.1.7-rc.2",
|
|
124
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.7-rc.2",
|
|
125
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
|
|
126
|
+
"@deepseek-ai/dsh-token-meter": "0.1.7-rc.2",
|
|
127
|
+
"@deepseek-ai/dsh-tools": "0.1.7-rc.2",
|
|
128
|
+
"@deepseek-ai/dsh-user-approval": "0.1.7-rc.2",
|
|
129
|
+
"@deepseek-ai/dsh-user-questions": "0.1.7-rc.2",
|
|
130
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
131
|
+
"@eslint/js": "^10.0.1",
|
|
132
|
+
"@testing-library/react": "^16.3.2",
|
|
133
|
+
"@tsdown/css": "^0.22.14",
|
|
134
|
+
"@types/js-yaml": "^4.0.9",
|
|
135
|
+
"@types/node": "^22.20.0",
|
|
136
|
+
"@types/react": "~18.3.1",
|
|
137
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
138
|
+
"eslint": "^10.10.0",
|
|
139
|
+
"globals": "^17.12.0",
|
|
140
|
+
"jsdom": "29.1.1",
|
|
141
|
+
"lightningcss": "^1.33.0",
|
|
142
|
+
"react": "^18.2.0",
|
|
143
|
+
"react-dom": "^18.2.0",
|
|
144
|
+
"tsdown": "^0.22.2",
|
|
145
|
+
"typescript": "^6.0.3",
|
|
146
|
+
"typescript-eslint": "^8.69.0",
|
|
147
|
+
"vitest": "^4.1.8"
|
|
148
|
+
},
|
|
149
|
+
"scripts": {
|
|
150
|
+
"build": "pnpm -r --if-present run bundle",
|
|
151
|
+
"typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
|
|
152
|
+
"typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
|
|
153
|
+
"lint": "eslint packages scripts eslint.config.js",
|
|
154
|
+
"lint:fix": "eslint packages scripts eslint.config.js --fix",
|
|
155
|
+
"test": "vitest run",
|
|
156
|
+
"test:coverage": "vitest run --coverage",
|
|
157
|
+
"test:watch": "vitest",
|
|
158
|
+
"test:built": "vitest run --config vitest.built.config.ts",
|
|
159
|
+
"test:e2e:packed": "node scripts/packed-install-e2e.mjs",
|
|
160
|
+
"test:unit": "vitest run",
|
|
161
|
+
"verify:release": "node scripts/verify-release.mjs",
|
|
162
|
+
"pack:dry-run": "pnpm -r --if-present run pack:dry-run"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "dsh-external/dsh-context-compression-improved",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "./lib/index.js",
|
|
5
|
-
"description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
|
|
6
|
-
"engines": {
|
|
7
|
-
"dsh": ">=0.1.
|
|
8
|
-
},
|
|
9
|
-
"contributes": {
|
|
10
|
-
"tools": [],
|
|
11
|
-
"skills": []
|
|
12
|
-
},
|
|
13
|
-
"client": {
|
|
14
|
-
"main": "./lib/client.js"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "dsh-external/dsh-context-compression-improved",
|
|
3
|
+
"version": "0.7.0-beta.1",
|
|
4
|
+
"main": "./lib/index.js",
|
|
5
|
+
"description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
|
|
6
|
+
"engines": {
|
|
7
|
+
"dsh": ">=0.1.7-rc.1 <0.2.0-0"
|
|
8
|
+
},
|
|
9
|
+
"contributes": {
|
|
10
|
+
"tools": [],
|
|
11
|
+
"skills": []
|
|
12
|
+
},
|
|
13
|
+
"client": {
|
|
14
|
+
"main": "./lib/client.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -60,6 +60,15 @@ window.__ModuleLoader__.load({
|
|
|
60
60
|
const enabled = value.enabled;
|
|
61
61
|
return typeof enabled === "boolean" ? { enabled } : void 0;
|
|
62
62
|
}
|
|
63
|
+
/** Browser-safe mirror of the runtime intentSummary section (absent inherits off). */
|
|
64
|
+
function decodeIntentSummarySettings(value) {
|
|
65
|
+
if (value === void 0) return { enabled: false };
|
|
66
|
+
if (!isPlainRecord(value)) return void 0;
|
|
67
|
+
const keys = Object.keys(value);
|
|
68
|
+
if (keys.length !== 1 || keys[0] !== "enabled") return void 0;
|
|
69
|
+
const enabled = value.enabled;
|
|
70
|
+
return typeof enabled === "boolean" ? { enabled } : void 0;
|
|
71
|
+
}
|
|
63
72
|
/**
|
|
64
73
|
* Browser mirror of the runtime presetOptions section: absent inherits the
|
|
65
74
|
* preset defaults (decodes to `undefined`); present values must be a plain
|
|
@@ -1160,7 +1169,7 @@ window.__ModuleLoader__.load({
|
|
|
1160
1169
|
/**
|
|
1161
1170
|
* Decode one stored context-compression settings document with exactly the
|
|
1162
1171
|
* runtime schema's strictness: a plain object with only `profile`, `custom`,
|
|
1163
|
-
* `autoCompact`, and `
|
|
1172
|
+
* `autoCompact`, `codeSkeleton`, and `intentSummary` keys, a supported profile, a valid Custom
|
|
1164
1173
|
* document canonicalized to v3 exactly as the runtime resolver would, a
|
|
1165
1174
|
* strictly-shaped autoCompact section (absent inherits the 80% default), and
|
|
1166
1175
|
* a strictly-shaped codeSkeleton gate (absent inherits off). Anything else
|
|
@@ -1169,17 +1178,19 @@ window.__ModuleLoader__.load({
|
|
|
1169
1178
|
*/
|
|
1170
1179
|
function decodeSettings(value) {
|
|
1171
1180
|
if (!isPlainRecord(value)) return void 0;
|
|
1172
|
-
if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "presetOptions")) return;
|
|
1181
|
+
if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "presetOptions")) return;
|
|
1173
1182
|
const profile = value.profile;
|
|
1174
1183
|
const custom = value.custom;
|
|
1175
1184
|
const autoCompact = decodeAutoCompactSettings(value.autoCompact);
|
|
1176
1185
|
const codeSkeleton = decodeCodeSkeletonSettings(value.codeSkeleton);
|
|
1186
|
+
const intentSummary = decodeIntentSummarySettings(value.intentSummary);
|
|
1177
1187
|
const presetOptions = decodePresetOptionsSettings(value.presetOptions);
|
|
1178
|
-
return typeof profile === "string" && COMPRESSION_PROFILES.includes(profile) && isCustomCompressionPolicy(custom) && autoCompact !== void 0 && codeSkeleton !== void 0 ? {
|
|
1188
|
+
return typeof profile === "string" && COMPRESSION_PROFILES.includes(profile) && isCustomCompressionPolicy(custom) && autoCompact !== void 0 && codeSkeleton !== void 0 && intentSummary !== void 0 ? {
|
|
1179
1189
|
profile,
|
|
1180
1190
|
custom: canonicalizeCustomPolicy(custom),
|
|
1181
1191
|
autoCompact,
|
|
1182
1192
|
codeSkeleton,
|
|
1193
|
+
intentSummary,
|
|
1183
1194
|
...presetOptions === void 0 ? {} : { presetOptions }
|
|
1184
1195
|
} : void 0;
|
|
1185
1196
|
}
|
|
@@ -1472,6 +1483,7 @@ window.__ModuleLoader__.load({
|
|
|
1472
1483
|
zh,
|
|
1473
1484
|
en
|
|
1474
1485
|
});
|
|
1486
|
+
const tNav = ctx.locale?.bind?.(NS) ?? ((key) => key);
|
|
1475
1487
|
const injected = () => {
|
|
1476
1488
|
const form = ctx.configForms.get(ENTRY_ID);
|
|
1477
1489
|
const readDoc = () => decodeSettings(form.getSnapshot().value?.settings);
|
|
@@ -1551,7 +1563,7 @@ window.__ModuleLoader__.load({
|
|
|
1551
1563
|
name: "settings.section",
|
|
1552
1564
|
id: "context-compression",
|
|
1553
1565
|
order: 17,
|
|
1554
|
-
label: () =>
|
|
1566
|
+
label: () => tNav("nav"),
|
|
1555
1567
|
locale: NS,
|
|
1556
1568
|
inject: injected
|
|
1557
1569
|
}, ContextCompressionSettingsSection));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getLastIntentFold, i as getAdvisorState, n as INTENT_GATE_GROWTH_TOKENS, o as getObservedIntentEnabled, p as setSummaryOverride, s as getSummaryOverride, t as INTENT_GATE_FLOOR_FRACTION, v as DEFAULT_CONTEXT_COMPRESSION_SETTINGS } from "./intent-gate.js";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -75,6 +75,96 @@ async function buildEstimatorCatalog(deps) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
|
+
//#region src/runtime/summary-command.ts
|
|
79
|
+
const SUMMARY_COMMAND_NAME = "ctx-summary";
|
|
80
|
+
const USAGE = "Usage: /ctx-summary off|on|status";
|
|
81
|
+
/** Parse the raw argument string; `undefined` = unrecognized (usage error). */
|
|
82
|
+
function parseSummaryCommandArgs(rawInput) {
|
|
83
|
+
const token = rawInput.trim().toLowerCase();
|
|
84
|
+
if (token === "off" || token === "on" || token === "status") return token;
|
|
85
|
+
}
|
|
86
|
+
function describeFold(sessionId) {
|
|
87
|
+
const fold = getLastIntentFold(sessionId);
|
|
88
|
+
if (fold === void 0) return "none";
|
|
89
|
+
return `turn ${fold.turn}, seq ${fold.startSeq}..${fold.endSeq}`;
|
|
90
|
+
}
|
|
91
|
+
/** Human-facing status line; observability only, never a decision input. */
|
|
92
|
+
function formatSummaryStatus(sessionId) {
|
|
93
|
+
const override = getSummaryOverride(sessionId);
|
|
94
|
+
const enabled = getObservedIntentEnabled(sessionId);
|
|
95
|
+
const enabledText = enabled === void 0 ? "unknown (gate not evaluated yet)" : enabled ? "yes" : "no";
|
|
96
|
+
return [
|
|
97
|
+
`ctx-summary status:`,
|
|
98
|
+
` override: ${override ?? "default (settings-driven)"}`,
|
|
99
|
+
` intentSummary enabled (settings): ${enabledText}`,
|
|
100
|
+
` gate: floor >${Math.round(INTENT_GATE_FLOOR_FRACTION * 100)}% of window AND growth >${INTENT_GATE_GROWTH_TOKENS} tokens since last fold`,
|
|
101
|
+
` last fold: ${describeFold(sessionId)}`
|
|
102
|
+
].join("\n");
|
|
103
|
+
}
|
|
104
|
+
/** Resolve the invoking agent's session id (`''` when the host exposes none). */
|
|
105
|
+
function sessionIdOf(agent) {
|
|
106
|
+
const session = agent?.session;
|
|
107
|
+
if (session === void 0 || session.id === void 0 || session.id === null) return "";
|
|
108
|
+
return String(session.id);
|
|
109
|
+
}
|
|
110
|
+
/** Best-effort `CommandDefinitionId` brand; `undefined` on stripped hosts (registered without it). */
|
|
111
|
+
async function loadCommandDefinitionId() {
|
|
112
|
+
try {
|
|
113
|
+
return (await import("@deepseek-ai/dsh-commands")).CommandDefinitionId;
|
|
114
|
+
} catch {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Mount `/ctx-summary` for every composed human-command adapter. Never
|
|
120
|
+
* throws: the command is a convenience surface, and a host without the
|
|
121
|
+
* commands service (or with an incompatible registry shape) simply runs
|
|
122
|
+
* without it.
|
|
123
|
+
*/
|
|
124
|
+
function registerSummaryCommand(ctx) {
|
|
125
|
+
ctx.inject(["commands"], (injected) => {
|
|
126
|
+
const commands = injected.commands;
|
|
127
|
+
if (commands === void 0 || typeof commands.register !== "function") return;
|
|
128
|
+
(async () => {
|
|
129
|
+
try {
|
|
130
|
+
const definitionId = await loadCommandDefinitionId();
|
|
131
|
+
await commands.register({
|
|
132
|
+
name: SUMMARY_COMMAND_NAME,
|
|
133
|
+
description: "Turn-tail intent summary: temporarily disable/resume or inspect status",
|
|
134
|
+
...definitionId === void 0 ? {} : { definitionId: definitionId("dsh-context-compression-improved/ctx-summary") },
|
|
135
|
+
handler: async (invocation) => {
|
|
136
|
+
const args = parseSummaryCommandArgs(typeof invocation.rawInput === "string" ? invocation.rawInput : "");
|
|
137
|
+
if (args === void 0) return {
|
|
138
|
+
kind: "error",
|
|
139
|
+
text: USAGE
|
|
140
|
+
};
|
|
141
|
+
const sessionId = sessionIdOf(invocation.agent);
|
|
142
|
+
if (args === "status") {
|
|
143
|
+
if (sessionId === "") return {
|
|
144
|
+
kind: "error",
|
|
145
|
+
text: "ctx-summary: no session is attached to this invocation"
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
kind: "success",
|
|
149
|
+
text: formatSummaryStatus(sessionId)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (sessionId === "") return {
|
|
153
|
+
kind: "error",
|
|
154
|
+
text: "ctx-summary: no session is attached to this invocation"
|
|
155
|
+
};
|
|
156
|
+
setSummaryOverride(sessionId, args);
|
|
157
|
+
return {
|
|
158
|
+
kind: "success",
|
|
159
|
+
text: args === "off" ? "ctx-summary: turn-tail intent summary paused for this session (until process restart or `/ctx-summary on`)" : "ctx-summary: turn-tail intent summary resumed for this session (numeric gates still apply)"
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
} catch {}
|
|
164
|
+
})();
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
78
168
|
//#region src/preset-overlay.ts
|
|
79
169
|
/** Plugin-owned, reversible compression overlays for native agent presets. */
|
|
80
170
|
/**
|
|
@@ -742,6 +832,7 @@ function apply(ctx, config = {}) {
|
|
|
742
832
|
try {
|
|
743
833
|
if (config.estimatorCatalogRoute === true) registerEstimatorCatalogRoute(ctx);
|
|
744
834
|
if (config.advisorReportRoute === true) registerAdvisorReportRoute(ctx);
|
|
835
|
+
registerSummaryCommand(ctx);
|
|
745
836
|
if (config.presetOverlay !== true) return;
|
|
746
837
|
ctx.inject(["agentPresets"], (presetsCtx) => {
|
|
747
838
|
const installation = decorateAgentPresets(presetsCtx.agentPresets, {
|