DSH Plugins Marketplace

DSH Plugins

Plugins

/

dsh-compat-optimize

d

dsh-compat-optimize

Manifest valid

Fast path for DSH plugin compatibility checks: cache warm-up, one-shot reports, zero-token CLI

hasBundlePatch

dsh-compat-optimize

中文说明

Fast path for DSH plugin compatibility checks: warm disk caches, one-shot compact reports, and a zero-token offline CLI.

A DSH plugin plus a standalone Node CLI. No build step, no runtime dependencies.

node bin/compat-check-cli.mjs check          # 0 token, exit code is the verdict

1. Why

compat_check (from dsh-compat-check) is an LLM tool: every call re-sends the tool schema, a single check usually takes 4–8 round trips at 40–100K input tokens each — while all the work it does is local. This plugin keeps the same verdicts and removes the round trips:

StageBeforeWith this plugin
Tool schemaRe-sent with tools[] on every request (1,198 chars)compat_optimize description trimmed to 104 chars (tool definition ≈ 942 chars)
One check4–8 round tripsaction=run returns summary + report path + report body in one shot
Local compute283–552 ms, 69% spent re-parsing the 4.76 MB app.asar headerHeader parsed once, cached on disk and reused across processes (183 ms cold → 85 ms warm)
Offline / CIOnly reachable through the modelbin/compat-check-cli.mjs — 0 tokens, cron/CI friendly

deferLoading does not save tokens: the host still projects the tool definition into every request. Shrinking the description is what saves them.


2. Install

Drop the repository into your DSH plugins directory (default <baseDir>/plugins). No build, no npm install required:

git clone https://github.com/dongchiluo/dsh-compat-optimize.git <baseDir>/plugins/dsh-compat-optimize

<baseDir> resolves to $DSH_COMPAT_BASE_DIR, then $DSH_HOME, then your home directory. Nothing is hard-coded to a specific machine:

DSH_COMPAT_BASE_DIR=/opt/dsh node bin/compat-check-cli.mjs check

Loaded by DSH, the plugin registers one tool: compat_optimize (plugin id tool-compat-optimize).

Configuration

Defaults live in cordis.patch.yml and can be overridden per plugin id in your own profile (override replaces, it does not merge — omit a field and it falls back to the schema default).

FieldDefaultMeaning
baseDirempty = $DSH_COMPAT_BASE_DIR / $DSH_HOME / homeRoot for plugins, reports and cache
pluginsDirempty = baseDir/pluginsPlugin directory to check
installDirempty = auto-detectDSH install dir (may point at resources/app.asar)
outDirempty = baseDir/out/compatWhere reports are written
cacheDirempty = baseDir/.cache/compat-checkCache directory (shared format with dsh-compat-check)
iterations5bench iterations
warmOnStartfalseWarm the cache when the plugin starts
notesCacheTtlMs21600000 (6 h)Upstream response cache TTL
mainPluginDirempty = sibling dsh-compat-checkWhere to load the upstream check logic from
deferLoadingtrueDefer tool visibility (does not save tokens)

3. CLI (the zero-token deliverable)

node bin/compat-check-cli.mjs [command] [options]

Commands: check (default) · status · warm · notes · bench

OptionMeaning
--plugins-dir <dir>Plugin directory (default <baseDir>/plugins)
--install-dir <dir>DSH install dir (may point at resources/app.asar)
--out-dir <dir>Report directory (default <baseDir>/out/compat)
--cache-dir <dir>Cache directory (default <baseDir>/.cache/compat-check)
--jsonMachine-readable output
--warmWarm the cache before checking
--network / --offline / --refreshNetwork policy (off by default)
--notesCompare against upstream DSH releases
--bench [N]Repeat N times and report timings
--source <s>plugin (default) · optimized · fallback

Exit codes: 0 no broken plugins · 1 broken plugin found · 2 runtime error.

node bin/compat-check-cli.mjs check --json          # CI gate
node bin/compat-check-cli.mjs warm && node bin/compat-check-cli.mjs check
node bin/compat-check-cli.mjs bench --bench 10

The CLI never touches the network unless --notes, --refresh or --network is given.


4. Tool actions

actionWhat it doesNetwork
statusCache state: header entries, freshness, last run summaryNo
warmParse the app.asar header and persist itNo (unless withNetwork: true)
runRun a check, return compact summary + report path + report bodyNo
benchRun N times, report median/min/maxNo
notesCompare against upstream GitHub release + npm registryOn cache miss

Parameters: action (required), installDir, pluginsDir, outDir, cacheDir, iterations, refresh, withNetwork, source.


5. Cache layout

Default <baseDir>/.cache/compat-check/, byte-compatible with dsh-compat-check:

.cache/compat-check/
├─ asar-header/<sha1(resolve(asarPath))>.json      4.76 MB asar header
├─ asar-entry/<sha1(resolve(asarPath)|innerPath)>.json   small archived files (≤512 KB)
├─ upstream/<sha1(url)>.json                       GitHub / npm responses, TTL 6 h
└─ last-run.json                                   last check recorded by this plugin

Entries are validated by a content fingerprint (sha1 of the first 64 KB), not by size + mtimeMs: inside Electron, fs.statSync('app.asar') returns a synthetic stat (size=0, mtimeMs = process start), which would invalidate the cache on every run.


6. Self-test

node _selftest.mjs        # exit code 0 = all assertions passed

~60 assertions covering cache hits/misses, TTL edges, all five actions, plugin registration and a CLI smoke test. Temporary artifacts go to the OS temp dir (DSH_COMPAT_OPTIMIZE_TMPDIR to override). Everything runs without a DSH installation; the two assertions that import the DSH host packages (@deepseek-ai/schemastery, @deepseek-ai/dsh-tools) are skipped when those packages are not resolvable.


7. Benchmarks (Windows 11, Node 24)

Measured with node bin/compat-check-cli.mjs check --json (elapsedMs); the checkPlugins row is the median of 40 direct checkPluginsFallback() calls. Fixtures are synthetic plugin directories, each with engines.dsh plus three @deepseek-ai/* peer declarations — the shape of a real desktop install.

Scenario20 plugins120 plugins
checkPlugins (scan only)4.8 ms26.6 ms
CLI check end-to-end10 ms36–46 ms

That is 0.22–0.38 ms per plugin — the real hot path on Windows.

Why it dominates: every plugin costs at least one stat, one readFileSync and one JSON.parse, plus up to 8 directory levels scanned per @deepseek-ai/* declaration while looking for vendored host copies. On Windows those syscalls go through NTFS and Defender's real-time scan, far slower than Linux's dentry cache; pnpm/bun node_modules/.pnpm symlink farms make path resolution worse (the scan skips node_modules and dot-directories).

Optimization measured and rejected: caching exists/readJson in a per-run Map moved 20 and 120 plugins from 4.76 → 4.77 ms and 26.58 → 26.85 ms — noise. Windows' directory cache is already fast; repeated stat is not the bottleneck, the plugin count is. To move it, narrow the scan with include or keep checks off the hot path (warm + status).

asar numbers (174 MB app.asar, DSH installed): 191 ms uncached → 87–118 ms cold cache → 19 ms warm; CLI check 183 ms cold → 85–89 ms cached.

8. Requirements

  • Node.js ≥ 20 (uses built-in fetch, node:test-free plain assertions)
  • DSH >=0.2.1-rc.5 <0.3.0 when used as a plugin
  • Optional: dsh-compat-check — without it the built-in fallback is used

License

MIT

Comments

Loading…

Similar plugins

dsh-plugin-precheck

by BaqiF2

该仓库暂未提供项目说明。

Security & AuditDevelopment & InfrastructureTerminal & ClientsManifest valid

★ 1

↓ 217/wk

MIT

JavaScript

Oct 4, 2026

dsh plugin --profile web add dsh-plugin-precheck

Modifies DSH plugin code at runtime, with ordered patches, inspection, and hot reload.

Development & InfrastructureManifest valid

★ 20

↓ 669/wk

MIT

dsh plugin --profile web add dsh-harmony

by jiuyuan-yi

DeepSeek Harness 更新守卫:更新前检查插件兼容性,启动失败可自愈(测试版)

Development & InfrastructureManifest valid

★ 1

MIT

JavaScript

Nov 1, 2026

dsh plugin --profile web add dsh-update-guard

by orangeofcarl0-sys

DSH large-session performance plugin: zero-copy fork + projection warmup + chunked materialize

Development & InfrastructureManifest valid

★ 3

↓ 97/wk

MIT

JavaScript

Oct 23, 2026

dsh plugin --profile web add dsh-large-proj-perf

by memorax-ai

A library for patching, replacing and decorating dsh plugin during runtime

Development & InfrastructureManifest valid

★ 21

↓ 1.3k/wk

MIT

TypeScript

Oct 28, 2026

dsh plugin --profile web add dsh-harmony

by zhangzujian

DSH compatibility plugin for redundant same-mode sandbox escalation requests

Manifest valid

★ 3

MIT

JavaScript

Aug 14, 2026

dsh plugin --profile web add @zhangzujian/dsh-same-mode-sandbox-noop