返回目录
模型与 MCP 插件

dsh-carrick-optimize

Carrick-K7/dsh-carrick-optimize

Warm DSH session discovery so the history list is ready before the first request.

Stars
0
Forks
0
Issues
0
更新
21 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:Carrick-K7/dsh-carrick-optimize

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-carrick-optimize

A small DSH plugin that warms session discovery so the history sidebar is ready before the first request.

DSH's session/list walks every project and session directory, opens each log header, decompresses it, and stats the file. On a corpus with ~1,200 sessions that costs about a second per call, and the browser waits for it before rendering history. This plugin moves that scan to boot and caches the result.

What it does

  • Prewarms ctx.sessionPersistence.list() after startup and serves it from a stale-while-revalidate cache.
  • Invalidates on session/created and session/disposed, so new sessions do not wait for the TTL.
  • Optionally prewarms the most recently updated N sessions into the session-query observation cache.
  • Leaves live-session merging to sessionQuery, so running sessions and their titles stay fresh.
  • Restores the original method and clears its timer on unload.

Measured on DSH 0.2.1-rc.3 with 801 sessions: first session/list 306–376ms → 47–94ms.

Install

dsh plugin --profile web add git+https://github.com/Carrick-K7/dsh-carrick-optimize.git#v0.1.0
# restart DSH

Or from a packed tarball:

dsh plugin --profile web add file:/path/to/dsh-carrick-optimize-0.1.0.tgz

The package's cordis.patch.yml inserts:

- insert:
    - id: carrick-optimize
      name: dsh-carrick-optimize

Config

Override the entry in the profile patch:

- id: carrick-optimize
  config:
    listTtlMs: 60000
    prewarmList: true
    prewarmDelayMs: 500
    prewarmSessions: 2
Key Default Meaning
enabled true Disable the plugin
listTtlMs 60000 Cache window before background revalidation
prewarmList true Warm the listing at boot
prewarmDelayMs 500 Delay before boot prewarm
prewarmSessions 2 Recent sessions to decode; 0 disables
prewarmMaxSessionBytes 24 MiB Skip larger single logs
prewarmTotalBytes 48 MiB Total compressed-byte budget

Scope

  • This speeds up the history list and the first open of prewarmed sessions. It does not make an arbitrary cold session instant: DSH's concatenated Zstandard log needs a full decode, and pagination/projection need the full event array.
  • Plugin bundle loading is not affected. /plugins already serves Cache-Control: public, max-age=31536000, immutable.

Development

npm test
npm run check

Compatibility

Targets DSH 0.2.1-rc.3 (Cordis 4). It patches ctx.sessionPersistence.list, an internal service; revalidate after DSH upgrades. If the service is missing or already patched, the plugin stays idle and logs a warning.

License

MIT

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类模型与 MCP
规则置信度中

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。