bale
DSH plugin that compresses large tool outputs before they enter the model context, with hash-based retrieval of the original text.
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:AQYLPZ/bale說明文件
閱讀完整 README ↗配置参考
插件配置(cordis.patch.yml 的 config)
| 键 | 默认 | 说明 |
|---|---|---|
enabled | true | 总开关 |
minChars | 8192 | 低于此长度不压缩 |
maxChars | 33554432 | 超过此长度不压缩(32MB,防巨量输出卡死) |
tools | 见下 | 允许压缩的工具白名单 |
protectTools | 见下 | 强制不压缩的工具 |
kinds | ["log","json","code","diff","search","generic"] | 允许的压缩类型(text 默认停用) |
kindsAreOpen | true | true = 以 sidecar 判定为准,kinds 仅作参考;false = 严格按 kinds 过滤 |
sidecarUrl | http://127.0.0.1:8797 | sidecar 地址 |
timeoutMs | 15000 | 压缩超时(spill 全文场景自动放宽 4 倍) |
replaceMode | replace | replace 替换内容;preview 只加标记不替换 |
sidecarPython | null | sidecar 用的 pythonw 绝对路径 |
sidecarScript | null | sidecar.py 绝对路径 |
storeDir | null | 原文存储目录 |
wsDir | null | 工作区目录(CCR 缓存等) |
logFile | null | 插件日志路径 |
默认白名单:
tools: ['ops_bash', 'bash', 'pwsh', 'web_fetch', 'run_code']
默认保护名单(输出必须逐字精确的场景):
protectTools:
- read, edit, write, grep, glob
- ops_read_files, ops_inspect_local_file, ops_edit_file,
ops_write_file, ops_grep, ops_glob, ops_stat,
ops_read_table, ops_read_docx, ops_read_pdf
读代码、搜索代码、读文档类的工具一律不压 —— 模型需要精确行号、路径和代码原文,任何折叠都可能误导它。
环境变量(sidecar 层)
| 变量 | 默认 | 说明 |
|---|---|---|
HEADROOM_DISABLED_KINDS | text | 逗号分隔,禁用的 kind。设空串可全部启用 |
HEADROOM_STORE_DIR | /store | 原文存储目录 |
HEADROOM_STORE_MAX_MB | 256 | store 容量上限(超限按 mtime 淘汰最旧) |
HEADROOM_STORE_TTL_HOURS | 168 | store 保留时长(7 天) |
HEADROOM_WORKSPACE_DIR | /headroom_ws | 工作区 |
HEADROOM_LOG_DIR | `` | sidecar 日志目录 |
HEADROOM_HF_HOME | 自动推导 | HuggingFace 缓存目录(text 压缩用) |
HEADROOM_ALLOWED_PATHS | 空 | 允许 /compress 读取的额外目录(path 模式白名单) |
HEADROOM_CRIT_BUDGET | 200 | 关键行提取上限(行数) |
HEADROOM_SAMPLE_HEAD | 80 | generic 保留头部行数 |
HEADROOM_SAMPLE_TAIL | 40 | generic 保留尾部行数 |
HEADROOM_SAMPLE_MIN_CHARS | 8192 | generic 抽样触发阈值 |
插件配置(cordis.patch.yml 的 config)
| 键 | 默认 | 说明 |
|---|---|---|
enabled | true | 总开关 |
minChars | 8192 | 低于此长度不压缩 |
maxChars | 33554432 | 超过此长度不压缩(32MB,防巨量输出卡死) |
tools | 见下 | 允许压缩的工具白名单 |
protectTools | 见下 | 强制不压缩的工具 |
kinds | ["log","json","code","diff","search","generic"] | 允许的压缩类型(text 默认停用) |
kindsAreOpen | true | true = 以 sidecar 判定为准,kinds 仅作参考;false = 严格按 kinds 过滤 |
sidecarUrl | http://127.0.0.1:8797 | sidecar 地址 |
timeoutMs | 15000 | 压缩超时(spill 全文场景自动放宽 4 倍) |
replaceMode | replace | replace 替换内容;preview 只加标记不替换 |
sidecarPython | null | sidecar 用的 pythonw 绝对路径 |
sidecarScript | null | sidecar.py 绝对路径 |
storeDir | null | 原文存储目录 |
wsDir | null | 工作区目录(CCR 缓存等) |
logFile | null | 插件日志路径 |
默认白名单:
tools: ['ops_bash', 'bash', 'pwsh', 'web_fetch', 'run_code']
默认保护名单(输出必须逐字精确的场景):
protectTools:
- read, edit, write, grep, glob
- ops_read_files, ops_inspect_local_file, ops_edit_file,
ops_write_file, ops_grep, ops_glob, ops_stat,
ops_read_table, ops_read_docx, ops_read_pdf
读代码、搜索代码、读文档类的工具一律不压 —— 模型需要精确行号、路径和代码原文,任何折叠都可能误导它。