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

@lexjade-ai/lawquery-dsh

v0.1.1

Published

LexJade LawQuery: statute / judicial-interpretation / case-law search tools for the DeepSeek Harness, with a ModelScope-backed data manager (no-restart config)

Readme

LawQuery-DSH

LexJade LawQuery:一个 dsh(DeepSeek Harness)插件,把三个法律检索工具装进同一个 bundle:

| 工具 | 作用 | |---|---| | lawquery | 案例检索(bge 向量 + 关键词 + hybrid) | | lawsearch | 法条检索(精确条号 / 向量 / 关键词) | | lawsifsearch | 司法解释检索(精确 / 向量 / 关键词) |

外加一个 Web 设置面板分区「法律数据」:填一次 ModelScope 访问令牌,即可下载/校验/自动更新数据包(3 个 parquet 向量库 + bge onnx 模型,约 174 MB),全部即时生效,无需重启。

安装

# 从 git 安装(lib/ 已入库,零构建、无需 allowBuilds)
dsh plugin --profile web add github:LexJadeAI/LawQuery-DSH#<commit-sha>

# 或本地 checkout(开发态)
dsh plugin --profile web add /path/to/LawQuery-DSH

# npm 安装(腾讯镜像自动同步)
dsh plugin --profile web add @lexjade-ai/lawquery-dsh

安装后 dsh 会把本包登记进 profile 的 dsh.profile.bundles(声明了 dsh.bundle,见 cordis.patch.yml)。

更新

| 安装方式 | 更新命令 | |---|---| | git | dsh plugin --profile web add github:LexJadeAI/LawQuery-DSH#<新sha> | | npm | dsh plugin --profile web update @lexjade-ai/lawquery-dsh | | 本地路径 | 改代码后 npm run build,重启 dsh 进程 |

bundle 代码在 dsh 启动时装载,插件升级后需重启进程;数据包更新不需要重启。

数据包

数据集:Isaac10086/LawQuery-DSH(私有,需账号被授权)。数据目录默认 ~/.dsh/law-data。

设置 → 法律数据:

  • 访问令牌:ModelScope token,保存在 <harness home>/lawquery/config.json(权限 0600,仅本机使用)
  • 检测远端 / 下载缺失文件:拉取缺失资产,下载过程流式 sha256 校验,不匹配立即丢弃
  • 检查数据包更新:调用 ModelScope repo-tree API 拿服务端每个文件的 sha256 / size / 提交时间,与本地逐文件比对 → 已就绪 / 有更新 / 缺失
  • 下载更新:只拉有变化/缺失的文件(同样带校验)
  • 启动时自动检查并更新:开启后每次启动自动检查、自动拉取变化文件并即时生效

数据更新无需发布 manifest:把新文件传到数据集即被识别(tree API 是唯一事实来源)。

发布新数据用仓库自带脚本(令牌只经环境变量,不落盘):

MS_TOKEN=... python scripts/publish-data.py            # 默认数据集与本地资产路径
MS_TOKEN=... python scripts/publish-data.py <dataset> <local_root>

环境变量兜底(不使用设置页时)

LAWQUERY_PARQUET(案例)、LAWS_INDEX_PARQUET(法条)、LAWSIF_INDEX_PARQUET(司法解释)、LAWQUERY_EMBED_MODEL / LAWQUERY_EMBED_ONNX(bge 模型)、LAWQUERY_DEBUG=0 关闭诊断日志。

优先级:设置页解析出的路径 > 环境变量 > 内置默认(工作区 LexJade_Agent 资产)。

架构

  • 单包双面:lib/index.js(host:工具注册 + /api/lawquery/* 路由 + 配置热应用)与 lib/client.js(浏览器:设置分区 UI,window.__ModuleLoader__ 契约)
  • 零 dsh 内部运行时依赖:defineTool 的 schema 编译/校验、Context 类型都是仓库内实现(src/host/defineTool.ts、src/host/context.ts),运行时只依赖 onnxruntime-node / @huggingface/tokenizers / hyparquet
  • 引擎在 src/lawcore/(移植自 dsh 内 box 的 law-core),索引与模型是进程级单例;配置变化时 configure() + resetCaches() 让下一次工具调用重新加载 — 这就是「免重启」的实现
  • 下载走固定链接 https://modelscope.cn/api/v1/datasets/<dataset>/repo?Revision=<rev>&FilePath=<path>,令牌以 cookie m_session_id 传递(302 到签名 CDN,支持 Range 断点续传)

开发

npm install --ignore-scripts   # onnxruntime-node 的 postinstall 只为拉 CUDA 包,CPU 二进制已随包发布
npm run build                  # esbuild → lib/index.js + lib/client.js

onnxruntime-node 在 pnpm ≥10 下其构建脚本默认不执行(dsh 安装路径即如此),CPU 后端开箱可用。

许可

MIT