rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:JayYuen666/dsh-rtk
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Compresses bash/pwsh output with the local rtk CLI before it reaches the model: a rewritten command prefix, a post-execute pipe fallback, and a settings card that reports what it saved.
A dsh plugin that puts the local rtk binary between a shell tool and the model. rtk itself stays on your machine; the plugin only orchestrates it.
prefix shadows bash per agent and routes the command through rtk rewrite first; pipe feeds a finished shell result through rtk pipe -f <filter> and replaces only the model-facing text. Until you set enabled explicitly, it is on only when a supported rtk is detected; prefix is the default form and pipe is opt-in.minBytes (256) and rewrites that save less than minGainRatio (0.95) pass through unchanged. The plugin never claims a saving it did not make.FAILURES (31): counts output lines, not failing tests — a 15-failure run prints 31. Rather than rewrite a number it has not verified, the plugin adds one line under the header: what the count means, how many failing blocks the input really has, and whether any were folded away.cd <repo> && cargo test — the shape multi-repo work produces constantly — is split into segments and only the one carrying the output is rewritten (cd <repo> && rtk cargo test). Constructs that cannot be split (command substitution, redirection, background &, unbalanced quotes) still run unchanged as a whole.dsh plugin --profile web add @jayyuen66/dsh-rtk
Remove with dsh plugin --profile web remove @jayyuen66/dsh-rtk. The package is on the public npm registry; no credentials, no scoped-registry line.
>= 24.9 (ESM-only; that floor is what makes require() of an ESM entry work, hence engines.node).dsh at 0.2.2-rc.2 or later on the 0.2.x line. The host reads engines.dsh (^0.2.2-rc.2) and it decides alone — with that field present, compatibility is judged before peerDependencies is ever consulted, prereleases included. Any 0.2.x at or above 0.2.2-rc.2 passes the host gate; 0.2.2-rc.1 and anything older does not. Strict npm peer resolution likewise accepts nothing below 0.2.2-rc.2, and on the prerelease side only the 0.2.2 tuple (0.2.2-rc.2 onward) — a later minor's prerelease such as 0.2.3-rc.1 waits for its stable release. 0.3.0 and later need the risk grant dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk. The support window rolls: at publish time this package is checked against every released host version inside the window — the judgement is the host's --dump-config layer line for this package, while the settings card and its namespace calls are verified once in full on the release's development baseline — and re-verified once the window moves, so the version number in this bullet is not a standing promise.underdependencies, by contract** (test/publish-manifest.test.ts). Profiles install withnodeLinker: hoistedandautoInstallPeers: false, so a host package there becomes a real second copy;@deepseek-ai/dsh-toolskeys its scheduler with a plainSymbol, so **every native tool call throws** in that profile while build, typecheck and coverage stay green. The@deepseek-ai/dsh*peers carry the same support-window range (^0.2.2-rc.2), while the exact pins indevDependencies` are the compile-time discipline against a second host type surface — not a claim the host consults.rtk >= 1.0.0 on PATH. This is the one runtime dependency outside npm: brew install rtk on macOS/Linux, winget install rtk-ai.rtk on Windows. Without it the plugin still loads and every compression path fails open.host.js, client.js, the package-local on-demand chunk client.insights-echarts.js, cordis.patch.yml, icon.svg, both READMEs, CHANGELOG.md, THIRD_PARTY_NOTICES.md, locale/zh.json + locale/en.json, and docs/ (both DETAIL files). Artifacts are rebuilt by prepack, never committed.dsh --profile web --dump-config ends with # == @jayyuen66/dsh-rtk plus - id: rtk. That command is the only accepted signal and is not read-only — read layer lines from stdout and check stderr separately; accept both # == <layer> and # == <layer>, patched by <path>.rtk not found there means the host process's PATH differs from your shell's.enabled: true and the card's counters at zero, ask the model to run a build or a test suite: the next card refresh shows the call and the byte delta./api gateway; auth, Host/DNS-rebinding/Origin checks and body limits are all the gateway's.dsh rtk … does not exist.rtk command as a subprocess and consumes its stdout. rtk's Apache-2.0 surface is what it uses; nothing from the BUSL engine is linked or redistributed.tools/pre-execute from rewriting a tool call's arguments (they are already logged and rendered). The prefix shape therefore works by shadowing bash per agent, not by mutating an existing call.settings / tools / subprocess / workingDirectory (all in inject). spillStore, sandboxPolicy and storageDomain are read through ctx.get() and degrade gracefully when absent — storageDomain is only consulted once to migrate the old accumulator, so its absence merely costs a slice of historical counters.dsh.bundle.patch points at cordis.patch.yml, whose insert: block carries a - id: dsh-plugin-shared supplier row (keep it enabled; disabling it removes the cards' shared component supply) plus the - id: rtk entry with name: "@jayyuen66/dsh-rtk" — the bare package name is what makes the host scan the client half. The card components come from the shared client row, externalized as @jayyuen66/dsh-plugin-shared/client; the host module table provides react, zod and that shared row.pending (waiting for service: …)); a malformed ctx throws required services … missing from apply.config:; precedence is card runtime value > row config > schema .default().enabled explicitly, it stays off when rtk is missing or below the supported floor and turns on once a supported rtk is detected. prefix is the default form. Turn the switch off manually to pin it off, or on to pin it on; both the switch and the form selector take effect on the next tool call.| prefix | pipe | |
|---|---|---|
| When | before the command runs | after the shell result exists |
| How | shadow bash per agent, ask rtk rewrite, run the rewritten form |
feed captured stdout through rtk pipe -f <filter> |
| What the model sees | the compressed output of the rewritten command | the compressed output, original markers and exit code preserved |
| Failure mode | rewrite rejected → original command runs | filter unusable → original text delivered |
| Compound commands | rewritten segment by segment: only the output-bearing segment changes | the whole command's output is compressed together |
| Default | on when enabled is on |
off (waiting for rtk to cover more shapes) |
Compound handling under prefix deserves its own paragraph: rtk already rewrites segment by segment (rewrite_compound in discover/registry.rs), and cd /tmp && cargo test measurably becomes cd /tmp && rtk cargo test. The plugin splits both the original command and the product into segments, requires the separator sequence to match one for one, and runs P1–P4 on each segment (a segment that was not touched must be byte-identical; the touched one may only gain a leading rtk). Anything else is rejected and the original command runs.
| Key | Default | Meaning |
|---|---|---|
enabled |
unset | master switch; until set, on only when a supported rtk is detected |
enabledForms |
['prefix'] |
which shapes may act; takes effect on the next tool call |
denyCommands |
[] |
extra command patterns never rewritten |
enabledFilters |
['cargo-test','pytest','ctest'] |
pipe filters that may act |
minBytes |
256 |
outputs smaller than this are never compressed |
minGainRatio |
0.95 |
a compression that keeps ≥95% of the bytes is discarded |
stdoutCapBytes |
64000 |
cap on what the filter returns: the compressed body is tail-truncated to this many bytes (the exit marker is kept) |
warnHint |
true |
append the compile-warning hint after cargo test |
rewriteHostEnv |
'' |
value for RTK_REWRITE_HOST; empty leaves it unset |
pipeTimeoutMs |
3000 |
restart-only |
rewriteTimeoutMs |
2000 |
restart-only |
rewriteCacheSize |
256 |
restart-only |
vitestMaxMajor |
5 |
restart-only; vitest at or above this major is not compressed |
logFilterMode |
'off' |
restart-only |
The config schema has 14 fields; 13 of them carry built-in defaults, while enabled follows rtk readiness until you set it explicitly. 9 of them volatile — the settings card writes those and they take effect on the next tool call, enabledForms included. The remaining non-volatile deployment values, 5 of them, are read once at assembly, so changing them needs a restart.
The left sidebar gains an rtk page. The two shapes are reported separately and never merged: prefix reports how many commands were rewritten and how many tokens that saved; pipe reports how many outputs were compressed and how many tokens that saved. They are not the same quantity, and one blended savings rate would explain neither.
Charts use Apache ECharts 6.1, loaded on demand: it is not in the entry bundle at all, and only opening this page downloads the half-megabyte charting code as a package-local chunk (client.insights-echarts.js, pulled by the host through require.async; switching tabs does not download it twice). The two-bar chart on the settings card shares the same chunk. License and copyright notices are in THIRD_PARTY_NOTICES.md.
engines.dsh and the @deepseek-ai/dsh* peers are ^0.2.2-rc.2 (one line, no union); @deepseek-ai/schemastery peer is ^3.19.0; engines.node is >=24.9.0.
rtk 1.2.0 was the version every claim in this repository was measured against. The plugin requires >= 1.0.0; below that it reports the version it found and does nothing.
rtk binary. No network call is made by this plugin.$DSH_HOME/rtk/history.db (default ~/.dsh/rtk/history.db, with $DSH_HOME resolved the same way the host resolves it). The plugin prefixes every rewritten rtk segment with RTK_DB_PATH pointing at that file, so rtk books its rows there and nowhere else — the rtk you run in your own terminal, and rtk gain, are neither affected nor counted here. Pipe compression counters and the per-event detail of both shapes live in dsh_* tables in the same database (SQLite via node:sqlite; if it cannot be opened only the statistics are lost, compression is unaffected). rtk never reads those tables and never drops them; kept for 90 days, no lifetime total.cargo test or git status), the working directory, the filter name, the reason and the counters. rtk's tables in that ledger do hold original_cmd; the plugin only reads it, and only ever shows its command family — the raw text never reaches the page or the statistics.tokenMeter (falling back to bytes / 4 when the service is absent — the same density as rtk's own estimate_tokens_from_len). The pipe form measures both ends, so its saving is measured; what prefix saves is the book rtk keeps for "original vs rewritten command", which the plugin only reads rather than estimates itself.read-only the prefix savings cannot be read (the ledger is not writable, so the page says so plainly while the rewrite counters stay visible) and pipe statistics keep working; under workspace-write the plugin registers $DSH_HOME/rtk/ as a session-scoped writable root (through its physical path, so a symlinked /tmp still lands) and both faces work normally; danger-full-access adds no further restriction.commands and its siblings, deleted the same way rtk gain --reset deletes them) plus the plugin's own dsh_* tables. Only $DSH_HOME/rtk/history.db is touched — your global rtk gain history stays put, which is exactly what the checkbox in the dialog says. The old single accumulator (the rtk_stats storage domain) is migrated once into a snapshot the first time it is opened, and never accumulates again.rtk rewrite does not know whether a flag asks for more detail. It rewrites cargo test -- --nocapture and pytest -vv just like the quiet form, and the detail is then compressed away. The plugin refuses to rewrite any command carrying a detail flag; when it does compress, the loss is bounded by the guard, not by rtk.npm run <script> is never rewritten. rtk maps a script name to a tool name (npm run lint → rtk lint), which would run ESLint instead of your script. The plugin drops any rewrite that removes a word from the original command.ls, find, grep/rg can replace a long listing with a +N more marker; the guard detects the marker family and rejects the compression, so folded listings never reach the model through this plugin.args.command inside execute, which runs after the pipeline's tools/pre-execute stage. General command approval (auto-review, danger-guard, Claude-Code-style hooks) therefore evaluates the frozen original arguments (cargo test) while the rewritten form (rtk cargo test) is what actually runs. Sandbox escalation approval is inside orig.execute and is preserved untouched, because the plugin never spawns the command itself. The plugin's own safety net in front of that gap is three subtractions — the information-loss deny table (git diff / git log / git show <ref> / ls / find / grep / rg / cargo clippy / aws), the P1–P4 rewrite checks (only a prefix may be stripped, no script-runner word may disappear), and the vitest major gate. Danger commands (rm -rf, git push --force) are not in rtk's rewrite surface at all, so they run unchanged and are reviewed unchanged — danger-guard is not bypassed.git diff / git log / ls / find / grep / rg / cargo clippy / aws, …) and the vitest major gate are evaluated per segment, because cd x && git diff starts with cd — evaluating the whole string would disable the entire table. On a hit the command is not taken apart either: someone typing cd X && git status expects one complete execution, and handing the first half to the shell while stitching the second half back is not the plugin's job.rtk pipe on a failing pytest run keeps the failure names but not always the assertion body. The guard checks for a success claim and for the failing line; a filter output that passes both but still loses detail is a known limit of the filter, not of the guard.pnpm install --ignore-scripts
pnpm run check # typecheck + lint + build + test + fmt:check
pnpm run smoke @jayyuen66/dsh-rtk from the umbrella workspace mounts the package into a sandbox DSH_HOME; the accepted signal is the --dump-config layer line.
Issues and pull requests are welcome: https://github.com/JayYuen666/dsh-rtk/issues.
If a plugin fails to boot, include the dsh host version, the profile install shape, and the browser console line. The missed the module table line is especially useful: it tells us whether the shared client row was materialized.
MIT for this plugin. rtk is Apache-2.0 for the CLI and command filters this plugin uses; see THIRD_PARTY_NOTICES.md.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness、deepseek-harness-plugin。