DSH Plugins
返回列表
🤖

dsh-result-cap

模型推理 更新于 2026.09.01

在终端中运行以下命令:

dsh plugin install jwilson411/dsh-result-cap

将以下提示词粘贴到 DeepSeek Harness 对话框中:

在 DeepSeek Harness 中执行 dsh plugin install jwilson411/dsh-result-cap 即可安装,插件源码位于 https://github.com/jwilson411/dsh-result-cap。

插件介绍

A fetch tool returns a four-megabyte page, the whole thing lands in the conversation, and the run is over—nothing failed, but one result consumed every slot of context. dsh-result-cap exists for exactly that: it applies a deterministic UTF-8 byte cap to tool-result strings, keeps the first N bytes, drops the rest, and lets the run continue. Three design commitments do the heavy lifting. The truncated flag is present only when a cap actually fired; an uncapped result returns byte-for-byte with no wrapper, so the flag carries real signal and nothing is ever shortened silently. The accompanying sha256 digests the full original, not the prefix, so a later complete copy can be verified against the truncated one. The cut respects UTF-8 boundaries—a multi-byte character straddling the limit is dropped whole rather than torn into replacement sequences. On top of that, the same input under the same cap always yields the same output, digest included: no clock, no counter, no randomness, no model call anywhere in the path.

What it deliberately is not deserves equal attention. It is not a context-window manager and does not decide what belongs in the conversation. It is not a compressor, an encoder, or a semantic summarizer; no relevance scoring happens, the first N bytes are simply the first N bytes. It is not a quota: it does not deny calls or fail a run. Its relationship to dsh-tool-quota is complementary—quota throws on overflow and discards the result whole; result-cap truncates and continues. The two compose: set the quota ceiling above your cap and quota fires only on shapes the cap passes through, like an oversized binary.

It is aimed at DeepSeek Harness agent developers whose tool chains include fetch, read, or API-call tools that can return large text bodies. You do not modify the tool itself; you set one number, maxBytes (default 8192), in your profile or via the DSH_RESULT_CAP_MAX_BYTES environment variable for deployment-wide control. The cap is also exported as a plain function from the package root, so it can be used in tests or on a host side that needs a truncation point outside the tool boundary.

使用场景

  • fetch 工具返回超大页面时,防止单条结果耗尽整个上下文窗口
  • 截断后通过 sha256 摘要校验原始完整性,确认被截去的内容
  • 与 dsh-tool-quota 组合,对超限结果截断并继续运行而非整条丢弃

适合人员

  • DeepSeek Harness agent 开发者,工具链中包含 fetch、read 等可能返回大文本的工具
  • 需要确定性、可复现的字节级截断而非语义压缩或摘要的工程师
  • 在多代理编排中需要保护上下文预算、杜绝静默截断的团队