dsh-context-compression-improved 0.5.4 → 0.6.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 (28) hide show
  1. package/README.md +10 -1
  2. package/package.json +162 -140
  3. package/packages/selector/README.md +6 -1
  4. package/packages/selector/README.zh.md +6 -1
  5. package/packages/selector/dsh.plugin.json +1 -1
  6. package/packages/selector/lib/advisor-state.js +1 -1
  7. package/packages/selector/lib/client.d.ts +19 -104
  8. package/packages/selector/lib/client.js +42 -5
  9. package/packages/selector/lib/index.d.ts +9 -0
  10. package/packages/selector/lib/index.js +18 -50
  11. package/packages/selector/lib/profiles.d.ts +105 -0
  12. package/packages/selector/lib/pruner.js +3 -2
  13. package/packages/selector/package.json +114 -114
  14. package/packages/selector/src/client/index.ts +71 -8
  15. package/packages/selector/src/index.ts +35 -86
  16. package/packages/selector/src/pruner.ts +12 -3
  17. package/packages/selector/src/runtime/config.ts +1 -1
  18. package/packages/selector/tests/code-skeleton.client.spec.ts +93 -90
  19. package/packages/selector/tests/custom-contract.client.spec.ts +19 -1
  20. package/packages/selector/tests/helpers/legacy-namespace.ts +31 -0
  21. package/packages/selector/tests/host-preset-overlay.host.spec.ts +206 -206
  22. package/packages/selector/tests/preset-options-write.client.spec.ts +63 -82
  23. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +206 -201
  24. package/packages/selector/tests/public/package-contract.client.spec.ts +2 -2
  25. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +3 -2
  26. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +20 -17
  27. package/packages/selector/tests/settings-seat.client.spec.ts +2 -2
  28. package/packages/selector/tests/standing-generation.host.spec.ts +704 -697
package/README.md CHANGED
@@ -47,7 +47,16 @@ Choose a compression profile, set the Auto Compact trigger level, and toggle cod
47
47
 
48
48
  ## Install
49
49
 
50
- Build and install from source — the fork is also published to npm as `dsh-context-compression-improved` (dist-tag `dsh-0.1.5`). The internal package names intentionally stay upstream's:
50
+ **Recommended: install from npm.** One dist-tag per Harness line — `dsh-0.1.5` for the 0.1.5 line (this branch), `dsh-0.1.2` for the 0.1.2 line.
51
+
52
+ ```sh
53
+ dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
54
+ # DSH 0.1.2 line:
55
+ # dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
56
+ dsh --profile web --dump-config
57
+ ```
58
+
59
+ From source (alternative — the internal package names intentionally stay upstream's):
51
60
 
52
61
  ```sh
53
62
  git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
package/package.json CHANGED
@@ -1,140 +1,162 @@
1
- {
2
- "name": "dsh-context-compression-improved",
3
- "version": "0.5.4",
4
- "publishConfig": {
5
- "registry": "https://registry.npmjs.org",
6
- "access": "public",
7
- "tag": "dsh-0.1.5"
8
- },
9
- "type": "module",
10
- "main": "packages/selector/lib/index.js",
11
- "types": "packages/selector/lib/index.d.ts",
12
- "exports": {
13
- ".": {
14
- "types": "./packages/selector/lib/index.d.ts",
15
- "default": "./packages/selector/lib/index.js"
16
- },
17
- "./invariant": {
18
- "types": "./packages/selector/lib/invariant.d.ts",
19
- "default": "./packages/selector/lib/invariant.js"
20
- },
21
- "./pruner": {
22
- "types": "./packages/selector/lib/pruner.d.ts",
23
- "default": "./packages/selector/lib/pruner.js"
24
- },
25
- "./client": {
26
- "types": "./packages/selector/lib/client.d.ts",
27
- "default": "./packages/selector/lib/client.js"
28
- },
29
- "./package.json": "./package.json"
30
- },
31
- "dependencies": {
32
- "@deepseek-ai/schemastery": "3.18.2",
33
- "@huggingface/tokenizers": "0.1.3",
34
- "js-yaml": "^4.3.2"
35
- },
36
- "dsh": {
37
- "client": {
38
- "inject": [
39
- "@deepseek-ai/dsh-client-locale",
40
- "@deepseek-ai/dsh-client-ui-primitives",
41
- "@deepseek-ai/dsh-client-ui-slots",
42
- "@deepseek-ai/dsh-client-ui-settings"
43
- ],
44
- "platform": "web"
45
- },
46
- "bundle": {
47
- "patch": "./packages/selector/cordis.patch.yml"
48
- }
49
- },
50
- "license": "MIT",
51
- "packageManager": "pnpm@11.7.0",
52
- "engines": {
53
- "node": "^22.19.0 || >=24.0.0",
54
- "dsh": ">=0.1.5-rc.1 <0.2.0-0"
55
- },
56
- "scripts": {
57
- "build": "pnpm -r --if-present run bundle",
58
- "typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
59
- "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
60
- "lint": "eslint packages scripts eslint.config.js",
61
- "lint:fix": "eslint packages scripts eslint.config.js --fix",
62
- "test": "vitest run",
63
- "test:watch": "vitest",
64
- "test:built": "vitest run --config vitest.built.config.ts",
65
- "test:e2e:packed": "node scripts/packed-install-e2e.mjs",
66
- "test:unit": "vitest run",
67
- "verify:release": "node scripts/verify-release.mjs",
68
- "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
69
- },
70
- "devDependencies": {
71
- "@deepseek-ai/cordis": "4.0.1",
72
- "@deepseek-ai/cordis-plugin-group": "1.0.1",
73
- "@deepseek-ai/cordis-plugin-include": "1.0.6",
74
- "@deepseek-ai/cordis-plugin-loader": "1.0.2",
75
- "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
76
- "@deepseek-ai/dsh-agent-loop": "0.1.5-rc.2",
77
- "@deepseek-ai/dsh-agent-loop-testkit": "0.1.5-rc.2",
78
- "@deepseek-ai/dsh-agent-presets": "0.1.5-rc.2",
79
- "@deepseek-ai/dsh-anonymous-user-id": "0.1.5-rc.2",
80
- "@deepseek-ai/dsh-api-remotes": "0.1.5-rc.2",
81
- "@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2",
82
- "@deepseek-ai/dsh-atomic-write": "0.1.5-rc.2",
83
- "@deepseek-ai/dsh-attachment": "0.1.5-rc.2",
84
- "@deepseek-ai/dsh-client-locale": "0.1.5-rc.2",
85
- "@deepseek-ai/dsh-client-store": "0.1.5-rc.2",
86
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.2",
87
- "@deepseek-ai/dsh-client-ui-session": "0.1.5-rc.2",
88
- "@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2",
89
- "@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.2",
90
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.5-rc.2",
91
- "@deepseek-ai/dsh-code-runtime": "0.1.5-rc.2",
92
- "@deepseek-ai/dsh-command-compact": "0.1.5-rc.2",
93
- "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
94
- "@deepseek-ai/dsh-compaction": "0.1.5-rc.2",
95
- "@deepseek-ai/dsh-compaction-basic": "0.1.5-rc.2",
96
- "@deepseek-ai/dsh-cordis-host-runner": "0.1.5-rc.2",
97
- "@deepseek-ai/dsh-credentials": "0.1.5-rc.2",
98
- "@deepseek-ai/dsh-goal": "0.1.5-rc.2",
99
- "@deepseek-ai/dsh-home-paths": "0.1.5-rc.2",
100
- "@deepseek-ai/dsh-host-plugin-inventory": "0.1.5-rc.2",
101
- "@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
102
- "@deepseek-ai/dsh-jobs": "0.1.5-rc.2",
103
- "@deepseek-ai/dsh-launch-environment": "0.1.5-rc.2",
104
- "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
105
- "@deepseek-ai/dsh-llm-deepseek": "0.1.5-rc.2",
106
- "@deepseek-ai/dsh-llm-retry": "0.1.5-rc.2",
107
- "@deepseek-ai/dsh-message-feedback": "0.1.5-rc.2",
108
- "@deepseek-ai/dsh-sandbox": "0.1.5-rc.2",
109
- "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
110
- "@deepseek-ai/dsh-session": "0.1.5-rc.2",
111
- "@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2",
112
- "@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
113
- "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
114
- "@deepseek-ai/dsh-subagent": "0.1.5-rc.2",
115
- "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.5-rc.2",
116
- "@deepseek-ai/dsh-subagent-in-process-driver": "0.1.5-rc.2",
117
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.5-rc.2",
118
- "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
119
- "@deepseek-ai/dsh-token-meter": "0.1.5-rc.2",
120
- "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
121
- "@deepseek-ai/dsh-user-approval": "0.1.5-rc.2",
122
- "@deepseek-ai/dsh-user-questions": "0.1.5-rc.2",
123
- "@deepseek-ai/schemastery": "3.18.2",
124
- "@eslint/js": "^10.0.1",
125
- "@testing-library/react": "^16.3.2",
126
- "@tsdown/css": "^0.22.14",
127
- "@types/js-yaml": "^4.0.9",
128
- "@types/node": "^22.20.0",
129
- "@types/react": "~18.3.1",
130
- "eslint": "^10.10.0",
131
- "globals": "^17.12.0",
132
- "jsdom": "29.1.1",
133
- "lightningcss": "^1.33.0",
134
- "react": "^18.2.0",
135
- "tsdown": "^0.22.2",
136
- "typescript": "^6.0.3",
137
- "typescript-eslint": "^8.69.0",
138
- "vitest": "^4.1.8"
139
- }
140
- }
1
+ {
2
+ "name": "dsh-context-compression-improved",
3
+ "version": "0.6.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
+ "packageManager": "pnpm@11.7.0",
54
+ "engines": {
55
+ "node": "^22.19.0 || >=24.0.0",
56
+ "dsh": ">=0.1.5-rc.1 <0.2.0-0"
57
+ },
58
+ "scripts": {
59
+ "build": "pnpm -r --if-present run bundle",
60
+ "typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
61
+ "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
62
+ "lint": "eslint packages scripts eslint.config.js",
63
+ "lint:fix": "eslint packages scripts eslint.config.js --fix",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest",
66
+ "test:built": "vitest run --config vitest.built.config.ts",
67
+ "test:e2e:packed": "node scripts/packed-install-e2e.mjs",
68
+ "test:unit": "vitest run",
69
+ "verify:release": "node scripts/verify-release.mjs",
70
+ "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
71
+ },
72
+ "peerDependencies": {
73
+ "@deepseek-ai/dsh-client-locale": ">=0.1.5-rc.1 <0.2.0-0",
74
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.5-rc.1 <0.2.0-0",
75
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.1 <0.2.0-0",
76
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.5-rc.1 <0.2.0-0"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "@deepseek-ai/dsh-client-locale": {
80
+ "optional": true
81
+ },
82
+ "@deepseek-ai/dsh-client-ui-primitives": {
83
+ "optional": true
84
+ },
85
+ "@deepseek-ai/dsh-client-ui-settings": {
86
+ "optional": true
87
+ },
88
+ "@deepseek-ai/dsh-client-ui-slots": {
89
+ "optional": true
90
+ }
91
+ },
92
+ "devDependencies": {
93
+ "@deepseek-ai/cordis": "4.0.1",
94
+ "@deepseek-ai/cordis-plugin-group": "1.0.1",
95
+ "@deepseek-ai/cordis-plugin-include": "1.0.6",
96
+ "@deepseek-ai/cordis-plugin-loader": "1.0.2",
97
+ "@deepseek-ai/dsh-agent": "0.1.5-rc.2",
98
+ "@deepseek-ai/dsh-agent-loop": "0.1.5-rc.2",
99
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.1.5-rc.2",
100
+ "@deepseek-ai/dsh-agent-presets": "0.1.5-rc.2",
101
+ "@deepseek-ai/dsh-anonymous-user-id": "0.1.5-rc.2",
102
+ "@deepseek-ai/dsh-api-remotes": "0.1.5-rc.2",
103
+ "@deepseek-ai/dsh-api-session-controller": "0.1.5-rc.2",
104
+ "@deepseek-ai/dsh-atomic-write": "0.1.5-rc.2",
105
+ "@deepseek-ai/dsh-attachment": "0.1.5-rc.2",
106
+ "@deepseek-ai/dsh-client-locale": "0.1.5-rc.2",
107
+ "@deepseek-ai/dsh-client-store": "0.1.5-rc.2",
108
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.2",
109
+ "@deepseek-ai/dsh-client-ui-session": "0.1.5-rc.2",
110
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2",
111
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.2",
112
+ "@deepseek-ai/dsh-client-ui-workspace": "0.1.5-rc.2",
113
+ "@deepseek-ai/dsh-code-runtime": "0.1.5-rc.2",
114
+ "@deepseek-ai/dsh-command-compact": "0.1.5-rc.2",
115
+ "@deepseek-ai/dsh-commands": "0.1.5-rc.2",
116
+ "@deepseek-ai/dsh-compaction": "0.1.5-rc.2",
117
+ "@deepseek-ai/dsh-compaction-basic": "0.1.5-rc.2",
118
+ "@deepseek-ai/dsh-cordis-host-runner": "0.1.5-rc.2",
119
+ "@deepseek-ai/dsh-credentials": "0.1.5-rc.2",
120
+ "@deepseek-ai/dsh-goal": "0.1.5-rc.2",
121
+ "@deepseek-ai/dsh-home-paths": "0.1.5-rc.2",
122
+ "@deepseek-ai/dsh-host-plugin-inventory": "0.1.5-rc.2",
123
+ "@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
124
+ "@deepseek-ai/dsh-jobs": "0.1.5-rc.2",
125
+ "@deepseek-ai/dsh-launch-environment": "0.1.5-rc.2",
126
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
127
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.5-rc.2",
128
+ "@deepseek-ai/dsh-llm-retry": "0.1.5-rc.2",
129
+ "@deepseek-ai/dsh-message-feedback": "0.1.5-rc.2",
130
+ "@deepseek-ai/dsh-sandbox": "0.1.5-rc.2",
131
+ "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
132
+ "@deepseek-ai/dsh-session": "0.1.5-rc.2",
133
+ "@deepseek-ai/dsh-session-persistence": "0.1.5-rc.2",
134
+ "@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
135
+ "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
136
+ "@deepseek-ai/dsh-subagent": "0.1.5-rc.2",
137
+ "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.5-rc.2",
138
+ "@deepseek-ai/dsh-subagent-in-process-driver": "0.1.5-rc.2",
139
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.5-rc.2",
140
+ "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
141
+ "@deepseek-ai/dsh-token-meter": "0.1.5-rc.2",
142
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
143
+ "@deepseek-ai/dsh-user-approval": "0.1.5-rc.2",
144
+ "@deepseek-ai/dsh-user-questions": "0.1.5-rc.2",
145
+ "@deepseek-ai/schemastery": "3.18.4",
146
+ "@eslint/js": "^10.0.1",
147
+ "@testing-library/react": "^16.3.2",
148
+ "@tsdown/css": "^0.22.14",
149
+ "@types/js-yaml": "^4.0.9",
150
+ "@types/node": "^22.20.0",
151
+ "@types/react": "~18.3.1",
152
+ "eslint": "^10.10.0",
153
+ "globals": "^17.12.0",
154
+ "jsdom": "29.1.1",
155
+ "lightningcss": "^1.33.0",
156
+ "react": "^18.2.0",
157
+ "tsdown": "^0.22.2",
158
+ "typescript": "^6.0.3",
159
+ "typescript-eslint": "^8.69.0",
160
+ "vitest": "^4.1.8"
161
+ }
162
+ }
@@ -5,7 +5,12 @@ The installable Product Bundle for the unofficial community DeepSeek Harness con
5
5
  **0.1.0 highlights:** DeepSeek V4 Flash Vision's official tokenizer is included; users can choose the model-driven Auto Compact threshold; standard profile watermarks and compression parameters follow that choice.
6
6
 
7
7
  ```sh
8
- dsh plugin --profile web add dsh-context-compression-improved@latest
8
+ ```sh
9
+ dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
10
+ # DSH 0.1.2 line:
11
+ # dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
12
+ dsh --profile web --dump-config
13
+ ```
9
14
  dsh --profile web --dump-config
10
15
  ```
11
16
 
@@ -5,7 +5,12 @@
5
5
  **0.1.0 更新:**已加入 DeepSeek V4 Flash 视觉模型的官方 tokenizer;用户可选择模型驱动 Auto Compact 的触发阈值;标准 Profile 的水位与压缩参数会随该选择联动。
6
6
 
7
7
  ```sh
8
- dsh plugin --profile web add dsh-context-compression-improved@latest
8
+ ```sh
9
+ dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
10
+ # DSH 0.1.2 line:
11
+ # dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
12
+ dsh --profile web --dump-config
13
+ ```
9
14
  dsh --profile web --dump-config
10
15
  ```
11
16
 
@@ -4,7 +4,7 @@
4
4
  "main": "./lib/index.js",
5
5
  "description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
6
6
  "engines": {
7
- "dsh": ">=0.1.5-alpha.1 <0.2.0-0"
7
+ "dsh": ">=0.1.5-rc.1 <0.2.0-0"
8
8
  },
9
9
  "contributes": {
10
10
  "tools": [],
@@ -959,4 +959,4 @@ function invalidateOnTaskChange(state, todoVersion) {
959
959
  return true;
960
960
  }
961
961
  //#endregion
962
- export { COMPRESSION_PROFILES as C, deepFreeze as S, resolvePolicy as _, AUTO_COMPACT_THRESHOLD_LIMITS as a, resolveCustomPolicy as b, DEFAULTS as c, charsToTokens as d, codePointLength as f, resolveConfig as g, parseContextCompressionSettings as h, recordScore as i, PRUNE_MARKER as l, isValidAutoCompactThresholdPercent as m, invalidateOnTaskChange as n, CONTEXT_COMPRESSION_SETTINGS_NAMESPACE as o, isCompressionProfile as p, recordRecertified as r, ContextCompressionSettingsSchema as s, getAdvisorState as t, charsForTokens as u, CustomCompressionPolicySchema as v, assertNever as x, DEFAULT_CUSTOM_COMPRESSION_POLICY as y };
962
+ export { deepFreeze as C, assertNever as S, resolveConfig as _, AUTO_COMPACT_THRESHOLD_LIMITS as a, DEFAULT_CUSTOM_COMPRESSION_POLICY as b, DEFAULTS as c, charsForTokens as d, charsToTokens as f, parseContextCompressionSettings as g, isValidAutoCompactThresholdPercent as h, recordScore as i, DEFAULT_CONTEXT_COMPRESSION_SETTINGS as l, isCompressionProfile as m, invalidateOnTaskChange as n, CONTEXT_COMPRESSION_SETTINGS_NAMESPACE as o, codePointLength as p, recordRecertified as r, ContextCompressionSettingsSchema as s, getAdvisorState as t, PRUNE_MARKER as u, resolvePolicy as v, COMPRESSION_PROFILES as w, resolveCustomPolicy as x, CustomCompressionPolicySchema as y };
@@ -1,111 +1,8 @@
1
+ import { i as PresetOptionsSettings, n as ContextCompressionSettings, r as CustomCompressionPolicy, t as CompressionProfile } from "./profiles.js";
1
2
  import { Context } from "@deepseek-ai/cordis";
2
3
  import "@deepseek-ai/dsh-settings/types";
3
4
  import { SettingsScope } from "@deepseek-ai/dsh-client-ui-settings/client";
4
5
  import { InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
5
- //#region src/profiles.d.ts
6
- /** Public context-compression choices shared by the Host schema and browser selector. */
7
- declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "custom"];
8
- /** One supported context-compression profile. */
9
- type CompressionProfile = typeof COMPRESSION_PROFILES[number];
10
- /** Single canonical unit stored by a version-1 browser Custom document. */
11
- type CustomCompressionUnit = 'tokens' | 'context-percent';
12
- /** Whether Custom History may routinely rewrite an already-sent prefix. */
13
- type CustomPrefixPolicy = 'preserve' | 'pressure-break';
14
- /** Browser representation of one independently enabled Fresh or Aggregate budget. */
15
- interface CustomCompressionBudget {
16
- enabled: boolean;
17
- trigger: number;
18
- target: number;
19
- }
20
- /** Legacy browser representation of the Custom History working set. */
21
- interface LegacyCustomHistoryPolicy {
22
- enabled: boolean;
23
- trigger: number;
24
- keepRecentTurns: number;
25
- keepRecent: number;
26
- minReclaim: number;
27
- }
28
- /** Browser representation of Custom History tool-call and token-tail protection. */
29
- interface CustomHistoryPolicy {
30
- enabled: boolean;
31
- trigger: number;
32
- keepRecentToolCalls: number;
33
- keepRecentTokens: number;
34
- minReclaim: number;
35
- }
36
- /** Browser representation of the Custom-only Experimental TailTrim gate. */
37
- interface CustomTailTrimPolicy {
38
- enabled: boolean;
39
- trigger: number;
40
- }
41
- interface CustomCompressionPolicyCommon<HistoryPolicy> {
42
- unit: CustomCompressionUnit;
43
- fresh: CustomCompressionBudget;
44
- aggregate: CustomCompressionBudget;
45
- history: HistoryPolicy;
46
- prefixPolicy: CustomPrefixPolicy;
47
- }
48
- /** Legacy public Custom document; accepted and normalized before editing. */
49
- interface CustomCompressionPolicyV1 extends CustomCompressionPolicyCommon<LegacyCustomHistoryPolicy> {
50
- version: 1;
51
- }
52
- /** Legacy Custom document with a default-disabled TailTrim stage. */
53
- interface CustomCompressionPolicyV2 extends CustomCompressionPolicyCommon<LegacyCustomHistoryPolicy> {
54
- version: 2;
55
- tailTrim: CustomTailTrimPolicy;
56
- }
57
- /** Public Custom document with tool-call working-set protection. */
58
- interface CustomCompressionPolicyV3 extends CustomCompressionPolicyCommon<CustomHistoryPolicy> {
59
- version: 3;
60
- tailTrim: CustomTailTrimPolicy;
61
- }
62
- /** Exact public Custom document accepted by the Host and browser boundary. */
63
- type CustomCompressionPolicy = CustomCompressionPolicyV1 | CustomCompressionPolicyV2 | CustomCompressionPolicyV3;
64
- /** User-tunable Auto Compact coordination preferences. */
65
- interface AutoCompactSettings {
66
- thresholdPercent: number;
67
- }
68
- /**
69
- * Orthogonal code-skeleton reducer gate, mirrored browser-safe from the
70
- * runtime: independent of every profile, default off.
71
- */
72
- interface CodeSkeletonSettings {
73
- enabled: boolean;
74
- }
75
- /** Browser-safe mirror of the runtime presetOptions section. */
76
- interface PresetOptionsSettings {
77
- readonly dedupeToolResults?: boolean;
78
- readonly summaryLocator?: boolean;
79
- readonly prefixStabilizer?: boolean;
80
- readonly readState?: boolean;
81
- readonly estimatorMode?: '' | 'host' | 'direct';
82
- readonly estimatorProvider?: string;
83
- readonly estimatorModel?: string;
84
- readonly estimatorBaseUrl?: string;
85
- readonly estimatorApiKey?: string;
86
- readonly estimatorTimeoutMs?: number;
87
- /** Advisory advisor channel; `''` (the default) keeps the advisor off. */
88
- readonly advisorMode?: '' | 'host' | 'direct';
89
- readonly advisorTimeoutMs?: number;
90
- readonly advisorRefreshTurns?: number;
91
- readonly advisorScoreThreshold?: number;
92
- readonly advisorSampleLimit?: number;
93
- readonly advisorMinTokens?: number;
94
- }
95
- /** Durable settings section owned by this package. */
96
- interface ContextCompressionSettings {
97
- /** Default profile captured when each Session first reaches the pruner. */
98
- profile: CompressionProfile;
99
- /** Complete canonical policy captured with `profile` when the runtime first observes a Session. */
100
- custom: CustomCompressionPolicy;
101
- /** Auto Compact trigger captured with `profile` when the runtime first observes a Session. */
102
- autoCompact: AutoCompactSettings;
103
- /** Code-skeleton reducer gate captured independently of `profile`. */
104
- codeSkeleton: CodeSkeletonSettings;
105
- /** Optional tokenpilot-inspired sub-capability overrides (presence-validated only). */
106
- presetOptions?: PresetOptionsSettings;
107
- }
108
- //#endregion
109
6
  //#region src/client/preset-options.d.ts
110
7
  /** One partial edit of `presetOptions`; `undefined` clears the named field. */
111
8
  type PresetOptionsPatch = { readonly [K in keyof PresetOptionsSettings]?: PresetOptionsSettings[K] | undefined; };
@@ -254,9 +151,27 @@ interface SlotsService {
254
151
  declare module '@deepseek-ai/cordis' {
255
152
  interface Context {
256
153
  slots: SlotsService;
154
+ configForms: ConfigFormsFace;
257
155
  }
258
156
  }
259
157
  declare const inject: string[];
158
+ /** The configForms face this client consumes (structural; 0.1.7 ui-settings). */
159
+ interface ConfigFormsFace {
160
+ get<T>(entryId: string): {
161
+ getSnapshot(): {
162
+ status: 'loading' | 'ready' | 'unavailable';
163
+ value: T | undefined;
164
+ revision: number | undefined;
165
+ writable: boolean;
166
+ base: unknown;
167
+ user: unknown;
168
+ mode: 'host' | 'memory';
169
+ };
170
+ subscribe(listener: () => void): () => void;
171
+ set(field: string, value: unknown): Promise<boolean>;
172
+ unset(field: string): Promise<boolean>;
173
+ };
174
+ }
260
175
  declare function apply(ctx: Context): void;
261
176
  //#endregion
262
177
  export { type CompressionProfile, type CompressionProfileSelectorProps, type CompressionSelectorInjected, type ContextCompressionSettings, apply, inject };
@@ -1458,9 +1458,11 @@ window.__ModuleLoader__.load({
1458
1458
  const inject = [
1459
1459
  "slots",
1460
1460
  "locale",
1461
- "settingsScope"
1461
+ "configForms"
1462
1462
  ];
1463
1463
  const NS = "context-compression";
1464
+ /** 0.1.7: the profile entry whose config carries the compression settings doc. */
1465
+ const ENTRY_ID = "context-compression-improved-bundle";
1464
1466
  function sameCustomPolicy(left, right) {
1465
1467
  if (left.version !== 3 || right.version !== 3) return false;
1466
1468
  return left.version === right.version && left.unit === right.unit && left.prefixPolicy === right.prefixPolicy && left.fresh.enabled === right.fresh.enabled && left.fresh.trigger === right.fresh.trigger && left.fresh.target === right.fresh.target && left.aggregate.enabled === right.aggregate.enabled && left.aggregate.trigger === right.aggregate.trigger && left.aggregate.target === right.aggregate.target && left.history.enabled === right.history.enabled && left.history.trigger === right.history.trigger && left.history.keepRecentToolCalls === right.history.keepRecentToolCalls && left.history.keepRecentTokens === right.history.keepRecentTokens && left.history.minReclaim === right.history.minReclaim && left.tailTrim.enabled === right.tailTrim.enabled && left.tailTrim.trigger === right.tailTrim.trigger;
@@ -1471,10 +1473,45 @@ window.__ModuleLoader__.load({
1471
1473
  en
1472
1474
  });
1473
1475
  const injected = () => {
1474
- const scope = ctx.settingsScope.bind({
1475
- namespace: NS,
1476
- decode: decodeSettings
1477
- });
1476
+ const form = ctx.configForms.get(ENTRY_ID);
1477
+ const readDoc = () => decodeSettings(form.getSnapshot().value?.settings);
1478
+ const scope = {
1479
+ getSnapshot() {
1480
+ const snap = form.getSnapshot();
1481
+ return {
1482
+ status: snap.status,
1483
+ value: readDoc(),
1484
+ revision: snap.revision,
1485
+ writable: snap.writable,
1486
+ base: snap.base,
1487
+ user: snap.user,
1488
+ mode: snap.mode
1489
+ };
1490
+ },
1491
+ subscribe: (listener) => form.subscribe(listener),
1492
+ set: async (field, value) => {
1493
+ const next = { ...readDoc() ?? {} };
1494
+ next[field] = value;
1495
+ await form.set("settings", next);
1496
+ },
1497
+ unset: async (field) => {
1498
+ const next = { ...readDoc() ?? {} };
1499
+ delete next[field];
1500
+ await form.set("settings", next);
1501
+ },
1502
+ mutate: async (ops) => {
1503
+ const doc = { ...readDoc() ?? {} };
1504
+ for (const op of ops) {
1505
+ const [head, key] = op.path;
1506
+ if (head !== "presetOptions") return;
1507
+ const section = { ...doc.presetOptions ?? {} };
1508
+ if (op.op === "unset") delete section[key];
1509
+ else section[key] = op.value;
1510
+ doc.presetOptions = section;
1511
+ }
1512
+ await form.set("settings", doc);
1513
+ }
1514
+ };
1478
1515
  const writeAndConfirm = async (write, accepts) => {
1479
1516
  const beforeRevision = scope.getSnapshot().revision;
1480
1517
  await write();
@@ -1,3 +1,4 @@
1
+ import { n as ContextCompressionSettings } from "./profiles.js";
1
2
  import z from "@deepseek-ai/schemastery";
2
3
  import { Context } from "@deepseek-ai/cordis";
3
4
  //#region src/index.d.ts
@@ -25,6 +26,14 @@ interface Config {
25
26
  * `presetOptions.advisor*` settings keys.
26
27
  */
27
28
  advisorReportRoute?: boolean;
29
+ /**
30
+ * 0.1.7: the compression settings document as ONE `.volatile()` whole-object
31
+ * field (the old dedicated namespace has no declarative equivalent). The
32
+ * browser selector writes it through `configForms`; the runtime reads the
33
+ * dereferenced value. Loose section schemas keep unknown keys — the strict
34
+ * validation stays in `decodeSettings` (client) and the runtime resolver.
35
+ */
36
+ settings?: ContextCompressionSettings;
28
37
  }
29
38
  /** Loader validation for the standalone Bundle opt-in. */
30
39
  declare const Config: z<Config>;