dsh-context-compression-improved 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WilliamShi666
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # dsh-context-compression-improved
2
+
3
+ The installable Product Bundle for the unofficial community DeepSeek Harness context-compression selector.
4
+
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
+
7
+ ```sh
8
+ dsh plugin --profile web add dsh-context-compression-improved@latest
9
+ dsh --profile web --dump-config
10
+ ```
11
+
12
+ This one command installs the Bundle and its pinned `@huggingface/tokenizers` dependency; there is no separate runtime package. The Bundle contributes Host settings, the Web UI, and a reversible preset overlay. All presets except the exact built-in `minimal` id receive the compression stack; switching non-Minimal presets preserves the saved selector settings. Minimal pauses plugin compression without deleting the setting.
13
+
14
+ ## What it provides
15
+
16
+ It provides deterministic Fresh, Aggregate, History, Native tool-result, and Custom TailTrim compression; a plugin-owned `context_compression_retrieve` recovery tool; structured audit records; and a pinned offline DeepSeek V4 tokenizer. It uses only public DeepSeek Harness APIs and supports both `0.1.1-rc.2` and `0.1.2-alpha.5`; it does not patch Harness core.
17
+
18
+ Lossy rewrites require exact same-revision counts before and after replacement. Verified model ids are `deepseek-v4-flash`, `deepseek-v4-pro`, and `deepseek-v4-flash-vision-exp`. Vision text counting uses the separately pinned `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` tokenizer. Vision images use the official image-processor arithmetic validated against official golden fixtures and are reported as `tokenizer-estimate`: the four alignment residues over valid intrinsic dimensions are collapsed to their midpoint, with 384 tokens retained as the per-image upper bound; malformed or unevaluable dimensions use a fixed 256-token fallback. The estimate is not exact because the absolute prompt position and the adapter's final image projection are not publicly observable. Image-bearing tool-result candidates remain exact-ineligible and intact; unknown models, unavailable tokenizer assets, unsafe tool groups, and incomplete text measurements still fail open.
19
+
20
+ Audit log records use the prefix `context-compression audit ` and distinguish policy snapshots, skipped/disabled components, committed rewrites, fail-open errors, and observed core `compaction/summary` events. No audit record contains prompt or tool-result content.
21
+
22
+ The first `policy-frozen` record carries the complete settings/deployment snapshot. It is emitted through the Harness logger, so its retention follows the configured log sink; standard prune/replacement Session events remain the durable proof of committed rewrites. This package does not hard-code a private path below `~/.dsh`.
23
+
24
+ Verified compatibility: DeepSeek Harness `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-alpha.5`, Node `^22.19.0 || >=24`. No Harness core patch is required.
25
+
26
+ See the [full README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme) for profiles, defaults, audit evidence, Adaptive/cache limitations, upgrade/removal, and security guidance. Tokenizer provenance and checksums are in `assets/deepseek-v4/manifest.json` and `assets/deepseek-v4-vision-exp/manifest.json`, summarized in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). This package is not affiliated with or endorsed by DeepSeek.
package/README.zh.md ADDED
@@ -0,0 +1,26 @@
1
+ # dsh-context-compression-improved
2
+
3
+ 这是可直接安装的非官方社区 DeepSeek Harness 上下文压缩选择器 Product Bundle。
4
+
5
+ **0.1.0 更新:**已加入 DeepSeek V4 Flash 视觉模型的官方 tokenizer;用户可选择模型驱动 Auto Compact 的触发阈值;标准 Profile 的水位与压缩参数会随该选择联动。
6
+
7
+ ```sh
8
+ dsh plugin --profile web add dsh-context-compression-improved@latest
9
+ dsh --profile web --dump-config
10
+ ```
11
+
12
+ 这一条命令会安装 Bundle 及其固定版本的 `@huggingface/tokenizers` 依赖,不再需要单独的 runtime 包。Bundle 提供 Host 设置、Web UI 和可逆的 preset overlay。除 id 精确等于内置 `minimal` 的 preset 外,其他 preset 都会获得压缩能力;非 Minimal preset 之间切换时已保存设置保持不变。Minimal 只暂停插件压缩,不删除设置。
13
+
14
+ ## 本包能力
15
+
16
+ 本包提供确定性的 Fresh、Aggregate、History、Native 工具结果与 Custom TailTrim 压缩,插件自有的 `context_compression_retrieve` 恢复工具,结构化审计记录,以及固定版本的离线 DeepSeek V4 tokenizer。它只使用 DeepSeek Harness 的公开 API,兼容 `0.1.1-rc.2` 与 `0.1.2-alpha.5`,不修改 Harness 核心。
17
+
18
+ 有损改写要求 replacement 前后取得同 revision 的 exact count。明确验证过的模型 id 为 `deepseek-v4-flash`、`deepseek-v4-pro` 与 `deepseek-v4-flash-vision-exp`。视觉模型的文本计数使用独立固定的 `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` tokenizer。图像 token 使用由官方 golden fixtures 逐项验证的官方图像处理算术,并以 `tokenizer-estimate` 上报:有效 intrinsic 尺寸的四种对齐位置取中值,每张图片保留 384 token 上限;尺寸畸形或无法计算时固定计为 256 token。由于绝对 prompt 位置与 adapter 最终图片投影不可公开观测,该数值不标记为 exact。含图片的工具结果候选仍不具备 exact 资格并保持原样;未知模型、tokenizer 资产不可用、不安全工具组或文本计量不完整时继续 fail-open。
19
+
20
+ 审计日志以 `context-compression audit ` 开头,区分策略快照、组件关闭/跳过、已提交 rewrite、fail-open 错误和已观察到的核心 `compaction/summary`。审计记录不包含 prompt 或工具结果正文。
21
+
22
+ 首次 `policy-frozen` 会携带完整 settings/deployment 快照。它通过 Harness logger 输出,因此保留期限由部署的日志 sink 决定;标准 prune/replacement Session event 仍是已提交 rewrite 的持久证据。本包不会在 `~/.dsh` 下硬编码私有路径。
23
+
24
+ 已验证兼容:DeepSeek Harness `dsh-v0.1.1-rc.2` 与 `dsh-v0.1.2-alpha.5`,Node `^22.19.0 || >=24`。不需要修改 Harness 核心。
25
+
26
+ Profile、默认值、审计证据、Adaptive/cache 限制、升级/卸载与安全说明见[完整 README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme)。Tokenizer 来源与校验和在 `assets/deepseek-v4/manifest.json`、`assets/deepseek-v4-vision-exp/manifest.json`,并汇总于 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。本包与 DeepSeek 无隶属或背书关系。
@@ -0,0 +1,38 @@
1
+ # Third-party notices
2
+
3
+ Portions of this package are adapted from the MIT-licensed DeepSeek Harness, verified against `dsh-v0.1.1-rc.2` (`b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`).
4
+
5
+ ## DeepSeek Harness MIT notice
6
+
7
+ Copyright (c) 2026 DeepSeek
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ This package also distributes `tokenizer.json` and `tokenizer_config.json` from these pinned official repositories, both under the MIT license:
28
+
29
+ - `deepseek-ai/DeepSeek-V4-Pro` revision `0e1a0e5e52aea73055f50fef6f2423db370265b6` (serves `deepseek-v4-flash` and `deepseek-v4-pro`), in `assets/deepseek-v4/`.
30
+ - `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` revision `6821d6ad3681a4b137b066b76094fa82ebd0a380` (serves `deepseek-v4-flash-vision-exp`), in `assets/deepseek-v4-vision-exp/`. This tokenizer is a distinct artifact, not an alias of the V4 Pro tokenizer.
31
+
32
+ The exact provenance and SHA-256 values are in each directory's `manifest.json`; the upstream license text ships beside the assets. The vision image-token arithmetic is a port of the repository's `inference/image_processor.py` at the same pinned revision.
33
+
34
+ This package depends on `@huggingface/tokenizers` 0.1.3 under Apache-2.0. Its NPM package carries the dependency license text.
35
+
36
+ This package depends on `js-yaml` under MIT; its production dependency `argparse` is licensed under Python-2.0. Their NPM packages carry the dependency license texts.
37
+
38
+ This is an unofficial community package and is not endorsed by DeepSeek.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,23 @@
1
+ {
2
+ "repository": "deepseek-ai/DeepSeek-V4-Pro",
3
+ "revision": "0e1a0e5e52aea73055f50fef6f2423db370265b6",
4
+ "license": "MIT",
5
+ "modelIds": [
6
+ "deepseek-v4-flash",
7
+ "deepseek-v4-pro"
8
+ ],
9
+ "files": {
10
+ "tokenizer.json": {
11
+ "bytes": 6367146,
12
+ "sha256": "8f9f37ca37fdc4f5fd36d5cf4d3b0e8392edb4e894fd10cc0d70b4957c8633cf"
13
+ },
14
+ "tokenizer_config.json": {
15
+ "bytes": 801,
16
+ "sha256": "6ac8c8dc065ed118161d02dd532749ae3f52c243deac27872134fae2f50d8547"
17
+ },
18
+ "LICENSE.DeepSeek-V4-Pro.txt": {
19
+ "bytes": 1064,
20
+ "sha256": "1c8f573e830ca9b3ebfeb7ace1823146e22b66f99ee223840e7637c9e745e1c7"
21
+ }
22
+ }
23
+ }