dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
为 zhipuai/glm-5.3-flash 调优的「GLM 模式」Agent 预设:PTC 程序化工具调用、思考死循环守卫与工具空转守卫双层防护(源自活体事故复盘)、GLM 专属自动压缩(75%/22%)。
The "GLM Mode" agent preset for DeepSeek Harness, tuned end-to-end for zhipuai/glm-5.3-flash — PTC programmatic tool calling, GLM-specific auto-compaction, plus a reasoning loop guard and a tool spin guard out of the box.
dsh plugin add dsh-glm-mode
(The npm package name is unique; GitHub source also works: dsh plugin add hoyyang/dsh-glm-mode.)
Zero config required (every switch defaults to on). In a new session pick the "GLM Mode" agent preset and the zhipuai/glm-5.3-flash model.
dsh plugin add dsh-glm-modezhipuai/glm-5.3-flashAll knobs (in cordis.patch.yml; defaults are the recommended values):
| Key | Default | What it does |
|---|---|---|
| compactEnabled | true | Auto-compaction switch (false keeps manual /compact) |
| glmThresholdRatio | 0.75 | GLM session compaction threshold |
| glmRetainRatio | 0.22 | Retention ratio after compaction |
| otherThresholdRatio | 0.98 | Fallback threshold for non-GLM models |
| glmPresetEnabled | true | Install/remove the preset with the plugin |
| loopGuardEnabled | true | Reasoning loop guard switch |
| loopGuardRepeatThreshold | 8 | Consecutive sentence repeats that count as a loop |
| loopGuardMinSentenceChars | 48 | Minimum sentence length to compare (chars) |
| loopGuardMinReasoningChars | 2000 | Reasoning chars accumulated before arming |
| spinGuardEnabled | true | Tool spin guard switch |
| spinGuardStreakThreshold | 5 | Consecutive placeholder run_code calls before intervention |
| spinGuardMaxCodeChars | 200 | Code length cap for the placeholder test (≥ counts as real work) |
| spinGuardWindowMs | 900000 | Streak resets if the last placeholder is older than this |
Guard audit ledger: ~/.dsh/dsh-glm-mode/guard-events.jsonl (append-only JSONL; the kind field separates reasoning-loop from tool-spin).
agent-presentation mode: ptc folds the whole catalog into a single run_code tool; the model writes TypeScript and the runtime bridges tools.* calls.llm/stream waterfall wraps the chunk stream (zhipuai glm-* routes only), feeding reasoning deltas into a digit-normalized sentence repeater; on trigger it synthesizes finish{max-tokens} and hard-cancels the upstream request.llm/stream inspects each step's tool calls (placeholder = run_code with no real tools.* reference and short code); past the threshold, an agent/pre-step decision rewrite appends one corrective user message — a tail append that never touches the request prefix cache.scripts/selftest-loop-guard.mjs: truncation grammar compliance, route matrix, arming thresholds, fail-open, inject/reset/zero-awareness matrix, stall window, ledger safety)Does it only affect GLM models? Yes. Both guards and the compaction policy gate on the route (zhipuai glm-*); every other model is untouched.
Will it break normal answers? The reasoning guard arms only after 2,000 reasoning chars and ignores sentences under 48 chars; a spin-guard false positive costs one corrective message and never truncates anything.
How is this different from the built-in Kiro mode? Kiro mode is tuned for DeepSeek-family models. This plugin gives glm-5.3-flash its own preset (PTC + 1M compaction at 0.75/0.22) and the guard family. Both can coexist — compaction ownership yields deterministically per official semantics.
Where do the wire settings (thinking format / tool_stream) live? In your settings.yaml provider route (the officially recommended z.ai format), not inside this plugin — install and go.
pnpm install
npm run build # tsc compile + npm pack
npm run selftest # 52 synthetic self-test checks
MIT — see LICENSE.