Community plugin

LISHUANGXI1412 / dsh-preset-tuner

Tune DSH agent presets without freezing them: the profile override is regenerated from the shipped preset in app.asar, preserving upstream text byte for byte and inserting only your changes.

  • JavaScript
  • MIT
  • 0 stars
  • Nov 15, 2026

About this plugin

Written by the registry from verified metadata, not from the README.

dsh-preset-tuner is a DSH plugin published from the LISHUANGXI1412/dsh-preset-tuner repository.

  • Listing statusManifest verified
  • Manifest checkedNov 15, 2026
  • Packagedsh-preset-tuner
  • Repository createdNov 15, 2026

Capabilities and topics

dshdsh-pluginpresetagent-preset
From the repository README

README

Everything below this line is the repository's own document, cached here. This site did not write or review it.

dsh-preset-tuner

Tune DSH agent presets without freezing them.

In DSH, an agent preset (standard, ptc, minimal, cordis) is a plugin list that ships inside the app. If you want to change something inside a preset — the automatic compaction threshold, or add your own plugin to a group — the only supported way is to override the whole preset declaration in your profile's cordis.patch.yml. Hand-writing that override copies the preset list into your profile, and from then on you no longer receive upstream preset updates: the copy is frozen at the day you wrote it.

This plugin removes the freeze. Instead of a hand-written copy, it reads the shipped preset straight out of the running app (resources/app.asar) and regenerates the override:

  • the upstream declaration text is kept byte for byte,
  • your changes are only inserted as extra lines,
  • the result is written into a marked, managed block in your profile patch,
  • when DSH updates, the next sync (or the next startup, automatically) picks up the new upstream preset and carries your insertions over.

Why this exists

Two details of DSH make the naive approach fail:

  1. The live compaction-basic instance lives inside the agent preset, in a group that is isolated. A host-level plugin cannot reach that service (ctx.get('compaction') is missing), and a profile patch row - id: compaction-basic targets an inactive leftover row, not the live one. Writing it looks correct and does nothing.
  2. Overriding a preset row replaces its config wholesale. There is no deep merge, so you must restate the entire plugin list — which is exactly what used to freeze the preset.

dsh-preset-tuner restates it for you, from the app, every time.

Install

dsh plugin add dsh-preset-tuner

Restart DSH once. The plugin exposes a preset_tuner tool and installs a bundle patch that adds its own row; by default it changes nothing (presets: {}).

Configure

Set the plugin's config in your profile patch (or through the plugin config UI):

- id: preset-tuner
  name: dsh-preset-tuner
  config:
    autoSync: true
    presets:
      cordis:
        plugins:
          compaction-basic:
            group: compaction        # the plugin lives inside this group's isolated realm
            config:
              auto: true
              thresholdRatio: 0.5    # compact at ~524K instead of the default ~679K
              retainRatio: 0.16      # keep ~168K after compaction

Then:

preset_tuner(action="preview")   # see exactly what would be written
preset_tuner(action="sync")      # write it
# restart DSH

The same thing from a shell:

dsh-preset-tuner sync --resources "<DSH install>/resources" --config tuner.config.json

--config accepts the plugin config as JSON ({ "presets": { ... } }).

Adding your own plugin to a preset

presets:
  cordis:
    add:
      - id: my-evictor
        name: my-evictor
        group: compaction          # omit `group` for a top-level plugin
        config:
          batchTokens: 18000

Tool actions

actionwhat it does
statusread-only report: resolved profile, upstream source, shipped presets, managed blocks, drift, hand-written conflicts
previewreturns the exact text that sync would write, writes nothing
syncgenerates and writes the managed block(s); reports whether the upstream changed
clearremoves the managed block(s) and nothing else

Safety

  • Fail closed. If the upstream preset cannot be located, extracted, or placed (renamed plugin, changed layout, existing key conflict), nothing is written and the tool explains why.
  • Never edits upstream text. Only insertions; unit tests assert the insertion-only property on the real shipped presets.
  • Never silently overwrites upstream values. If upstream already sets a key you configure, the sync aborts instead of masking it.
  • Refuses to eat hand-written overrides. If your profile already has a hand-written - id: preset-<id> row, sync aborts and points at the line numbers. Taking over requires force and mode: "replace", which removes only those rows.
  • Backups. Every write first copies the previous file to <profile>/dsh-preset-tuner/backups/ (last 10 kept).
  • Idempotent. Unchanged input produces no write, so it never creates restart noise.
  • Auto-sync is conservative. On startup it only regenerates blocks it already owns; the first takeover is always an explicit sync.

Limits

  • A managed block still is a full preset declaration, because that is the only override the loader accepts. The difference is who maintains it: the plugin, from the app, instead of you by hand.
  • Changes take effect after a DSH restart. Existing sessions re-resolve the preset version on restart.
  • If you edit the same preset through the Web preset editor, that write is a hand-written override; sync will stop and ask before touching it.
  • Linux/macOS paths are untested on real installs; the code is path-agnostic but the app layout was verified on Windows.

Rollback

preset_tuner(action="clear")
# or delete the block between the `# >>> dsh-preset-tuner` markers in
# <profile>/cordis.patch.yml and restart

Backups stay in <profile>/dsh-preset-tuner/backups/ if you need the previous file.

License

MIT

Badge

Listed here? Link back with this badge — paste the snippet into your repository README.

Listed on DSH Plugin badge
[![Listed on DSH Plugin](https://dsh-plugin.com/badges/listed.svg)](https://dsh-plugin.com/plugins/LISHUANGXI1412/dsh-preset-tuner)