Skip to content

Releases: Jaylor-Wang/dsh-tool-result-trimmer

v1.5.0 - Per-Tool Overrides, Escape Hatch Bypass, & Command-Aware Semantic Reducers / 分工具差异化配置、紧急逃生通道与命令感知语义压缩器

Choose a tag to compare

@Jaylor-Wang Jaylor-Wang released this 23 Oct 08:23

English | 中文

English

What's Changed in v1.5.0

Per-Tool Overrides, Escape Hatch Bypass, & Command-Aware Semantic Reducers

This release introduces fine-grained tool controls, a multi-vector emergency escape hatch, and intelligent semantic reducers with a strict fail-open safety guarantee:

  • Layer 1: Emergency Escape Hatch (Bypass Routing):

    • Supports inline environment variables: DSH_TRIM_BYPASS=1, DSH_NO_TRIM=1, or NO_TRIM=1.
    • Supports inline comment directives: # no-trim, // bypass-trim, /* raw-output */, etc.
    • Supports execution argument flags: args.bypassTrim === true or args.noTrim === true.
    • When bypassed, tool output passes through with 0 mutations, 0 allocations, and full raw fidelity.
  • Layer 2: Per-Tool Overrides (overrides):

    • Configure granular character budgets (thresholdChars, headChars, tailChars) and ANSI stripping flags per tool name (e.g. bash, read, custom-tool).
    • Allows completely disabling trimming for specific critical tools (overrides: { my_tool: { enabled: false } }).
    • Added configuration diagnostics to warn when tool overrides specify overlapping budgets (thresholdChars < headChars + tailChars).
  • Layer 3: Command-Aware Semantic Reducers (Strict Fail-Open Guarantee):

    • Git Reducer:
      • Condenses clean working tree status into a single informative line.
      • Strips noisy advice hints (use "git add <file>...") on dirty trees while 100% preserving all modified, untracked, and deleted paths.
      • Removes uninformative index <hash>..<hash> <mode> metadata headers in git diff while keeping all diff hunks completely intact.
    • Package Manager Reducer:
      • Strips terminal progress spinners, deprecation notices, engine warnings, update notifications, and funding reminders for npm, pnpm, yarn, and pip.
      • Preserves package audit counts, installation summaries, and security vulnerability alerts.
    • Test Runner Reducer:
      • Collapses hundreds of verbose test passing lines into a single clean summary line for node --test, vitest, jest, pytest, and cargo test when 100% of tests pass.
      • Strict Fail-Open Safety: Never conceals failure! If any test fails, assertion fails, or an error code is returned, all semantic reductions yield immediately to preserve full error stacks, assertion diffs, and context traces untouched.
    • Configurable Toggles:
      • Enable/disable semantic reducers globally or individually via semanticReducers.git, semanticReducers.packageManager, and semanticReducers.testRunner.
  • Comprehensive Verification & Performance:

    • Expanded unit test coverage with 55 passing tests across the entire pipeline.
    • Ultra-fast zero-allocation path (>11.8M ops/sec sub-threshold throughput).
    • Full TypeScript typing declarations in index.d.ts and bilingual documentation.

Installation & Upgrade

# Via DSH Plugin CLI (Recommended)
dsh plugin --profile web add dsh-tool-result-trimmer@1.5.0

# Via npm / pnpm
npm install dsh-tool-result-trimmer@1.5.0
pnpm add dsh-tool-result-trimmer@1.5.0

Jump to Chinese / 跳转至中文


中文

v1.5.0 版本更新(分工具差异化配置、紧急逃生通道与命令感知语义压缩器)

分工具差异化配置、紧急逃生通道与命令感知语义压缩器

本次更新为插件带来了精细化调控能力、多通道紧急逃生机制以及基于 Fail-Open 原则的命令感知语义压缩器:

  • 第一环:紧急逃生通道(Bypass 机制):

    • 前缀环境变量:支持命令内联声明 DSH_TRIM_BYPASS=1、DSH_NO_TRIM=1 或 NO_TRIM=1;
    • 内联注释指令:支持命令中包含 # no-trim、// bypass-trim、/* raw-output */ 等标识;
    • 工具参数直通:支持在工具调用参数中声明 bypassTrim: true 或 noTrim: true;
    • 触发逃生时 0 修改、0 内存分配,保持绝对原始输出直通给大模型。
  • 第二环:分工具差异化配置(Per-Tool Overrides):

    • 支持按工具名称(如 bash、read、custom_tool)单独定制 thresholdChars、headChars、tailChars 与 stripAnsi;
    • 支持对特定敏感工具彻底禁用裁剪(overrides: { special_tool: { enabled: false } });
    • 启动阶段增加重叠预算安全校验,防止误配置引起逻辑异常。
  • 第三环:命令感知语义压缩器(Semantic Reducers · 严格 Fail-Open):

    • Git 压缩器:
      • 干净工作区收敛为单行;
      • 脏工作区剥离千篇一律的 (use "git add ...") 提示模板,100% 完整保留修改、新增与删除文件列表;
      • 剥离 git diff 中大模型无用的 index <hash>..<hash> 元数据行,完整保留所有差异代码块(Hunks)。
    • 包管理器压缩器:
      • 自动清理 npm、pnpm、yarn、pip 中的进度条动画残留、peer deprecation 警告、版本更新公告与 funding 赞助提示;
      • 完整保留依赖审计、包安装数量汇总与高危漏洞预警信息。
    • 测试运行器压缩器:
      • 仅在测试用例 100% 全部通过 时,将 node --test、vitest、jest、pytest、cargo test 的冗长逐项勾选列表压缩为 1 行清晰指标;
      • 严格 Fail-Open 安全底线:一旦检测到任何测试失败、断言异常或非零退出码,语义压缩立即主动弃权(Yield),原样保留完整错误堆栈、失败用例上下文与定位信息,绝不遮蔽任何 Debug 现场。
    • 细粒度配置开关:
      • 支持全局开启/关闭 semanticReducers.enabled,以及针对 git、packageManager、testRunner 的独立子开关。
  • 工程质量与性能保障:

    • 单元测试增至 55 项并通过全量流水线;
    • 保持轻量极速架构,未超阈值文本保持 >1180 万 ops/sec 吞吐与 0 内存开销;
    • 完善了 index.d.ts 完整类型声明与中英双语文档。

安装与升级

# 通过 DSH 插件命令安装或更新(推荐)
dsh plugin --profile web add dsh-tool-result-trimmer@1.5.0

# 通过 npm / pnpm 安装
npm install dsh-tool-result-trimmer@1.5.0
pnpm add dsh-tool-result-trimmer@1.5.0

Back to English / 返回英文

v1.3.0 - Global Multi-block Trimming, Zero-Allocation Pass-Through, & Unicode Safety / 全局多块裁剪、零分配快速直通与 Unicode 安全防护

Choose a tag to compare

@Jaylor-Wang Jaylor-Wang released this 22 Oct 14:13

English | 中文

English

What's Changed in v1.3.0

Global Multi-Block Trimming, Zero-Allocation Pass-Through, & Unicode Safety

This release delivers significant enhancements to trimming consistency, multi-block output handling, runtime performance, and Unicode code-point safety:

  • Global Aggregate Trimming Across Multiple Blocks:
    • Unifies threshold evaluation and character retention across all content blocks produced by a tool execution.
    • Generates line-aware head and tail boundaries across the virtual text stream while preserving non-text blocks (such as images) intact at their original positions.
    • Eliminates the previous limitation where multiple sub-threshold text blocks could bypass trimming and bloat the context window.
  • Zero-Allocation Pass-Through (Fast Pre-Scan):
    • Implements a lightweight single-pass pre-scan that inspects total text volume and ANSI escape markers.
    • Outputs that require no trimming and contain no ANSI codes are passed through with zero array allocations, zero object cloning, and zero latency (exceeding 12,000,000 ops/sec).
  • Unicode UTF-16 Surrogate Pair Protection:
    • Adds code-point boundary checking for supplemental multilingual planes (such as Emoji 😀).
    • Automatically realigns cutting points so head outputs never terminate with an orphaned high surrogate, and tail outputs never start with an orphaned low surrogate.
  • Bounded Tail Search Window:
    • Constrains the backward newline search window for output tails to Math.min(500, tailBudget), preventing massive lines from triggering unbounded tail expansion.
  • Configuration Guidance & Diagnostics:
    • Adds runtime warnings when thresholdChars < headChars + tailChars to alert users of overlapping budgets.
  • Comprehensive Benchmark Suite:
    • Integrated npm run benchmark to quantify real-world throughput across small, oversized, ANSI-heavy, and multi-block scenarios.

Installation & Upgrade

# Via DSH Plugin CLI (Recommended)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# Via npm / pnpm
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Jump to Chinese / 跳转至中文


中文

v1.3.0 版本更新(全局多块裁剪、零分配快速直通与 Unicode 安全防护)

全局多块裁剪、零分配快速直通与 Unicode 安全防护

本次更新对流水线修剪算法进行了全面升级,强化了跨多块文本预算分配、极端情况运行性能以及 Unicode 字符安全保护:

  • 针对整个结果的全局多块裁剪:
    • 彻底厘清并统一切割语义:以单次工具调用的所有文本块总量为基准进行阈值与首尾预算判定;
    • 在虚拟文本流中动态计算全局行吸附断点,并精准映射回各块,中间的图片等非文本块原样原位保留,彻底解决过去多个小文本块累计超标但绕过裁剪的问题。
  • 真正零开销延迟分配(Fast Pre-Scan):
    • 增加轻量级单次预检机制:对无 ANSI 码且未超出阈值的普通输出,直接原样返回原数组引用,实现 0 次数组分配、0 次对象克隆与微秒级极速放行(吞吐量突破 1200 万次/秒)。
  • Unicode UTF-16 代理对(Emoji)防截断:
    • 增加完整字符边界检查机制(针对 Emoji 等补充平面 4 字节字符);
    • 截断点自动向完整字符对齐,绝不产生孤立的高半区(\uD800-\uDBFF)或低半区(\uDC00-\uDFFF)乱码。
  • Tail 换行回退收敛约束:
    • 限制尾部换行向前搜索窗口至 Math.min(500, tailBudget),防止超长单行日志导致尾部预算失控暴涨。
    • 增加了对 thresholdChars < headChars + tailChars 预算重叠配置的日志告警与安全透传机制。
  • 基准测试套件集成:
    • 新增 npm run benchmark 命令,全面覆盖常规通过、ANSI 清洗、162KB 极端报错、多块聚合等生产级压测场景。

安装与升级

# 通过 DSH 插件命令安装或更新(推荐)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# 通过 npm / pnpm 安装
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Back to English / 返回英文

v1.2.0 - Automatic Terminal ANSI Escape Sequence Stripping / 终端 ANSI 杂质与控制字符自动剥离

Choose a tag to compare

@Jaylor-Wang Jaylor-Wang released this 21 Oct 05:22

English | 中文

English

What's Changed in v1.2.0

Automatic Terminal ANSI Escape Sequence Stripping

This release introduces proactive ANSI cleaning across the tool execution pipeline, purging terminal noise and color artifacts before outputs reach session storage or model context:

  • Proactive ANSI Cleaning (stripAnsi: true):
    • Automatically identifies and purges terminal ANSI color/styling codes (\x1b[31m, \x1b[0m), cursor movement and clearing controls (\x1b[2K, \x1b[1G), cursor visibility flags (\x1b[?25h), and window title sequences (\x1b]0;...).
    • Cleans terminal artifacts from tool outputs (such as bash builds, test runners, and package managers) even when total text length is within the truncation threshold, saving valuable tokens and eliminating parsing noise for LLMs.
  • Configurable Control:
    • Adds stripAnsi (default true) to the Schemastery config schema, allowing users to toggle ANSI stripping on demand via Cordis configuration.
    • Fully excludes protected inspection tools (read, read_image) from any output modifications.
  • Enhanced Test Suite:
    • Added full test coverage for SGR colors, cursor movements, OSC window titles, and plugin integration.

Installation & Upgrade

# Via DSH Plugin CLI (Recommended)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# Via npm / pnpm
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Jump to Chinese / 跳转至中文


中文

v1.2.0 版本更新(终端 ANSI 杂质与控制字符自动剥离)

终端 ANSI 杂质与控制字符自动剥离

本次更新在工具执行流水线中引入了主动式 ANSI 清洗能力,在工具输出进入会话持久化与模型上下文之前,彻底滤除终端颜色与光标干扰符:

  • 主动式 ANSI 清洗(stripAnsi: true):
    • 自动识别并剥离终端 SGR 颜色/字体样式控制码(\x1b[31m、\x1b[0m)、光标移动与清行控制符(\x1b[2K、\x1b[1G)、光标显隐标志(\x1b[?25h)以及窗口标题序列(\x1b]0;...);
    • 对 bash 等命令行输出(构建日志、测试框架、包管理器等)的杂质字符实现即时过滤。即便输出未达截断阈值,也能自动洗净乱码字符,消除 Token 浪费并大幅提升模型对代码/报错的识别精度。
  • 灵活可配:
    • 在 Schemastery 配置模型中新增 stripAnsi 字段(默认 true),支持在 cordis.patch.yml 中按需开启或关闭;
    • 严格保持对免截断工具(read、read_image)的原样透传与代码保护。
  • 测试用例扩充:
    • 针对 SGR 颜色、光标清行、OSC 标题、普通文本及插件集成新增多组单元测试,测试用例全部 100% 通过。

安装与升级

# 通过 DSH 插件命令安装或更新(推荐)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# 通过 npm / pnpm 安装
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Back to English / 返回英文

v1.1.0 - Wildcard DSH Compatibility & Marketplace Badge / 通配 DSH 版本兼容与插件市场徽章

Choose a tag to compare

@Jaylor-Wang Jaylor-Wang released this 21 Oct 02:59

English | 中文

English

What's Changed in v1.1.0

Wildcard DSH Compatibility & Marketplace Integration

  • Wildcard DSH Peer Dependency: Added "@deepseek-ai/dsh": "*" to peerDependencies and marked it as optional in peerDependenciesMeta.
  • Permanent Version Exemption Bypass: Unlocks full compatibility across all future DSH versions without requiring manual allow-version exceptions or encountering startup compatibility gates.
  • DSH Marketplace Badge (DSH *): Automatically renders the green [ DSH * ] compatibility tag inside the visual plugin market (dshmarket) and Web GUI discovery tabs.
  • Zero-Warning Installation: optional: true ensures clean, zero-warning installs across npm, pnpm, and yarn.

Installation & Upgrade

# Via DSH Plugin CLI (Recommended)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# Via npm / pnpm
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Jump to Chinese / 跳转至中文


中文

v1.1.0 版本更新(通配 DSH 版本兼容与插件市场徽章支持)

通配 DSH 兼容与市场徽章集成

  • 通配 DSH Peer 依赖声明:在 package.json 的 peerDependencies 中加入 "@deepseek-ai/dsh": "*",并在 peerDependenciesMeta 中将其标记为 optional: true。
  • 免手动版本豁免:解除 DSH 宿主安装门禁限制,后续即使升级到任何新版 DSH 也无需配置 allow-version 豁免规则。
  • 插件市场绿色徽章(DSH *):在 DSH 可视化插件市场(dshmarket)和 Web 插件卡片中自动点亮绿色的 [ DSH * ] 全版本兼容标识。
  • 无警告极简安装:通过 optional: true 消除 pnpm / npm 未安装宿主包时的 peer 依赖缺失警告。

安装与升级

# 通过 DSH 插件命令安装或更新(推荐)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# 通过 npm / pnpm 安装
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Back to English / 返回英文

v1.0.1 - DSH Bundle Manifest & Web GUI Integration / DSH Bundle 规范与 Web GUI 深度集成

Choose a tag to compare

@Jaylor-Wang Jaylor-Wang released this 20 Oct 17:13

English | 中文

English

What's Changed in v1.0.1

DSH Bundle & GUI Integration

  • DSH Bundle Manifest: Declared "dsh": { "bundle": { "patch": "./cordis.patch.yml" } } in package.json, allowing DSH to automatically recognize and mount the plugin as a first-class profile layer.
  • Cordis Patch Layer: Added cordis.patch.yml to insert tool-result-trimmer into the Cordis context with sensible defaults.
  • Bilingual GUI Metadata: Added locale/en.json and locale/zh.json with localized titles and descriptions for seamless display in the DSH Web GUI Plugin Manager and Settings.
  • Package Exports: Added exports for ./locale/*.json and ./package.json.

Installation & Upgrade

# Via DSH Plugin CLI (Recommended)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# Via npm / pnpm
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Jump to Chinese / 跳转至中文


中文

v1.0.1 版本更新(DSH 官方 Bundle 规范与 Web GUI 深度集成)

DSH 官方 Bundle 与 GUI 卡片支持

  • DSH Bundle 规范声明:在 package.json 中配置 "dsh": { "bundle": { "patch": "./cordis.patch.yml" } },使 DSH 插件管理器能将其自动识别为一等 Profile 组合层(Profile Layer)。
  • Cordis 补丁层定义:新增 cordis.patch.yml,声明 tool-result-trimmer 实例插槽与开箱即用的默认参数。
  • 中英文图形界面元数据:新增 locale/zh.json 与 locale/en.json,在 DSH Web GUI 的“插件管理”与“设置”中完美呈现标题、能力描述与启用状态卡片。
  • 导出路径补充:在 package.json 中补齐 ./locale/*.json 和 ./package.json 导出路径。

安装与升级

# 通过 DSH 插件命令安装或更新(推荐)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# 通过 npm / pnpm 安装
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Back to English / 返回英文

v1.0.0 - Eager Tool Result Trimmer / 即时工具结果修剪插件首发

Choose a tag to compare

@Jaylor-Wang Jaylor-Wang released this 20 Oct 17:01

English | 中文

English

Initial Release (v1.0.0)

dsh-tool-result-trimmer is a lightweight, zero-dependency Cordis plugin designed for DeepSeek Harness (DSH). It hooks into the tool execution pipeline to eagerly trim oversized tool outputs (such as massive compiler errors, verbose test outputs, or long command logs) before they pollute the conversation session log and LLM context.

Key Features

  • Eager Pipeline Trimming (Zero Log Bloat):
    Hooks into DSH's official tools/post-execute waterfall pipeline to trim oversized results before they enter session persistence or LLM context windows.
  • Tail-Heavy Budgeting:
    Preserves 1,500 characters at the head (arguments, initial states) and 5,000 characters at the tail (stack traces, exit codes, failure assertions).
  • Line-Aware Snapping:
    Snaps trimming boundaries to adjacent newlines (\n). Code lines, JSON structures, and error messages remain syntactically complete without broken words or surrogate corruption.
  • Zero-Side-Effect Safeguards:
    • Automatically excludes read and read_image tools to prevent disruption to file inspection and line numbers.
    • Multi-modal image and binary blocks are 100% preserved.

Installation

# Via DSH Plugin CLI (Recommended)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# Via npm / pnpm
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Jump to Chinese / 跳转至中文


中文

首发版本 (v1.0.0)

dsh-tool-result-trimmer 是专为 DeepSeek Harness (DSH) 与 Cordis 打造的轻量级、零运行时依赖的即时工具输出修剪插件。它直接挂载在工具执行流水线上,在超大输出(如编译报错海量输出、冗长测试日志、长命令滚屏)进入会话历史与 LLM 上下文之前实现即时裁剪,从源头杜绝上下文污染。

核心特性

  • 时机提前(Eager Trim · 零日志死重):
    直接挂载于 DSH 官方 tools/post-execute 瀑布流水线。超长结果在进入持久化日志、提交给模型上下文之前就已经被裁剪完毕。
  • 权重倒置(Tail-Heavy · 强化尾部):
    默认策略头部保留 1,500 字符(查看启动入参与初始状态),尾部保留 5,000 字符(完整保留报错堆栈、断言失败与退出码)。
  • 行吸附算法(Line-Aware Snapping · 绝不截断代码行):
    动态吸附到最近的换行符(\n),保证头部在完整行末尾结束,尾部从新行行首开始,杜绝半截单词与语法破碎。
  • 零副作用安全保护:
    • 默认跳过 read 与 read_image 工具,保证文件查看行号绝对精准。
    • 图片等非文本块 100% 原样透传。

安装命令

# 通过 DSH 插件命令安装(推荐)
dsh plugin --profile web add dsh-tool-result-trimmer@latest

# 通过 npm / pnpm 安装
npm install dsh-tool-result-trimmer@latest
pnpm add dsh-tool-result-trimmer@latest

Back to English / 返回英文