npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-session-search-warmup

v0.3.1

Published

DSH 会话搜索预热:进程启动的安静窗口内静默构建官方 SQLite FTS5 索引,让官方搜索第一次查询即毫秒级响应

Readme

dsh-session-search-warmup

在 DSH 进程启动的安静窗口内静默预热官方会话搜索索引,让官方搜索第一次 查询即可用。

背景(为什么需要它)

搜索引擎(@deepseek-ai/dsh-session-query-sqlite)在首次搜索时才建索引。 其观察循环要求整个持久化语料在连续两轮快照之间保持字节级静止(只重试两次)。 语料较大时一轮观察就要几十秒,这期间任何活跃会话日志被追加事件(本会话的 工具调用、其他标签页、子代理),构建都会以 SESSION_QUERY_PERSISTENCE_FAILED 失败。由于索引一行都没提交,之后每次搜索 都会重复同样注定失败的全量构建,横幅就一直挂着。

进程刚启动时还没有活跃会话,语料天然静止:激活后立刻发起一次搜索即可把索引 提交,之后的搜索都是毫秒级增量。

行为

  • 激活后(宿主平面,sessionQuery 可用时)发起一次 searchSessions({ query: 'warmup', … }, {})
  • 若失败码为 SESSION_QUERY_PERSISTENCE_FAILEDSESSION_QUERY_ABORTED (「窗口还不够安静」的瞬时错误),每 15 秒重试一次,最多 20 次(约 5 分钟), 超限后放弃,等下次启动再预热。
  • 其他错误视为不可重试,停止并输出 [session-search-warmup] 前缀日志。

相关插件

本插件完全独立生效:无论是否安装 dsh-session-search-plus,官方搜索 表面(未接管的官方侧栏搜索框、窄栏模式、回退路径)第一次查询都快—— 预热调用提交的是全语料索引,之后每个官方查询都复用它。 dsh-session-search-plus 只是接管侧栏搜索框的 UI 增强(私有内存索引、 /api/search-plus 路由、过滤栏 / 下拉 / 跳转高亮),两者互补但互不依赖。

前置条件

  • profile 必须挂载 @deepseek-ai/dsh-session-query-sqlite,且配置 openAt: first-search(或 startup)+ 持久化 path——否则预热出的索引 无法跨重启存活。openAt: never(base 默认值)的 profile 上没有预热 对象:插件会安静停止,并在启动日志输出可操作的 [session-search-warmup] 提示。
  • Node ≥ 22(依赖 node:sqlite)。

安装

在 profile 目录执行:

dsh plugin --profile web add dsh-session-search-warmup
# 或手动:在 package.json 的 dependencies 与 dsh.profile.bundles 中加入本包
# (file: 路径),然后 pnpm install

注意:不要同时把 session-search-warmup 这一 insert 行写进 profile 自己的 cordis.patch.yml——loader 会因重复 insert id 拒绝启动(与 dsh-ui-attention 等插件同款规则)。

验证

dsh --profile web --dump-config   # 应出现 session-search-warmup 行

启动后观察宿主日志:

[session-search-warmup] full-text index warmed on attempt 1

并确认持久索引有数据:

sqlite3 ~/.dsh/session-search.sqlite 'select count(*) from persisted_sessions;'

开发

pnpm install
pnpm run bundle   # 构建 lib/
pnpm test