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-muv-engine

v0.3.11

Published

DSH 原生 MUV 引擎 —— 正则脚本、状态栏级联(任意字段/行动选项)、变量追踪、LaTeX、宏展开、标签 CSS、visual 代码块渲染(信纸/终端/报纸/手机),内置 diag.mjs 诊断工具。需与伴生插件 dsh-muv-table 一起安装

Readme

⚙️ dsh-muv-engine

DSH 原生 MUV 引擎 —— 酒馆伴生插件。

🔗 依赖 dsh-muv-table,配合 dsh-tavern-v2 使用。

🆕 v0.3.4 更新内容

本次是一个大修版,修的都是「不报错但结果不对」的静默失败;同时新增了诊断工具。

状态栏渲染

  • 行动选项不再整段消失:三级解析器(yaml / free / loose)对选项标记的支持范围 不一致,导致 A. B. C. 这种最常用的写法被静默丢弃。现在统一支持 A. A、 1. 1、 - • 以及无前缀的裸选项。
  • 支持任意字段:以前只认 名字/行动/内心/衣着 四个字段,卡片实际给出的 穿搭/小穴/胸部/肛门/阳具/最近性行为 等全部丢失。现在按 标签: "值" 通用提取, 卡片写什么就渲染什么。
  • 条目不再要求从行首开始:用户列表: - 用户: 名字: "…" 这种带前缀的写法以前会 导致整条角色丢失,只剩一个头部条。
  • 选项标题兼容英文 Options / Choices / Actions / Select;兼容 ## 行动选项 这类 markdown 装饰;章节标签不再重复渲染;选项挤在一行时也能正确拆分。

消息渲染

  • 修复插画不显示、原始标签糊满屏幕:取角色卡时只用 sessionId 定位,三种兜底 全落空时会拿到别人的卡,于是卡里的正则全部静默不执行——<img> 不被替换、 隐藏块不生效。现在优先使用酒馆界面上的当前预设。
  • 纯 <choices> 回复(没有状态栏、只有剧情+选项)以前会被入口闸门跳过,现在能渲染。
  • 变量块:识别 <VariableInsert> / <VariableEdit> / <VariableThink> / <Abstract>, 收进折叠卡片而不是把 JSON 糊在屏幕上。
  • 消息定位改用形状匹配 + 块级子节点判定,不再依赖会随 DSH 重建变化的 CSS Modules 哈希,也不会误伤同名的文件类型图标。

新增诊断工具 diag.mjs

一条命令查完:服务器是否加载了新代码、每个预设绑的哪张卡、SillyTavern PNG 卡库、 实时 API 返回,还能把一段消息过一遍渲染管线(报用了哪张卡、正则是否命中、 有无残留标签、外链图片是否可达)。

node diag.mjs                 # 全量体检
node diag.mjs --tests         # 附带跑回归
node diag.mjs --preset <id> --msg-file msg.txt   # 测一条消息

回归测试从 46 项增至 84 项(node test-status-cascade.mjs)。

是什么

替代 MagVarUpdate 的 DSH 原生实现,v0.3.0 起融合了 dsh-visual-render:

🎮 变量与状态

  • 正则引擎:执行角色卡 regex_scripts,实时替换 LLM 输出
  • 变量追踪:跨对话轮次追踪变量状态,自动提取 <UpdateVariable> 块
  • 状态栏渲染:提取 <StatusPlaceHolderImpl/> 的 HTML,iframe 沙箱渲染

🎲 宏展开

聊天输入框内直接写宏,按 Enter 自动展开后发送给 AI:

{[random::去酒楼::去坊市::去洞府]}     → 每次随机选一个
{[pick::宝箱::灵石x50::剑谱::丹药]}    → 固定结果,缓存为「宝箱」
{[roll::2d6+3]}                       → 掷 2d6 加 3 调整值
  • 支持调整值:{[roll::1d20+5]}、{[roll::3d6-1]}
  • pick 缓存可用 _tavernRerollPick('key') 重抽(浏览器控制台)
  • 控制台调试:_tavernExpandMacros('...') / _tavernListPicks()

🏷️ 标签渲染

AI 输出自动美化(_tavernRenderTags 钩子),支持转义形态(&lt;标签&gt;):

| 标签 | 效果 | |---|---| | <speech> | 斜体灰色对白 | | <action> | 绿色斜体动作 | | <thought> / <thinking> | 紫色斜体内心 | | <char> / <character> | 金色粗体角色名 | | <dialogue> | 蓝色左边框 | | <赏令接取> ~ <自由开局> | 独立配色游戏卡片(金/紫/青/蓝/青绿/橙) | | <Drama> | 暗红渐变戏剧卡片(含 .mys 内容区样式) | | <choices> | 选项按钮(按行解析,支持 A、/1./•/无前缀) | | <style> | 自动剥离(世界书模板 CSS 不展示) | | <inventory> / <背包> / <skill> | 折叠列表卡片 | | <quote> / <引用> | 引用块 |

🖼️ visual 代码块渲染(融合 dsh-visual-render)

聊天里 ```visual 代码块自动渲染为沙箱 HTML 界面:

  • 信纸 / 终端 / 报纸 / 手机 / 浏览器组件
  • options 代码块 → 可点击剧情选项按钮
  • aside 代码块 → 淡色旁白
  • scene 代码块 → 场景标题卡
  • iframe sandbox 隔离,安全运行

🌠 LaTeX 渲染

\(...\) 公式自动渲染(含 array/fcolorbox/colorbox/textcolor/rule 等)。

安装

dsh plugin --profile web add dsh-muv-engine

API 端点

| 端点 | 方法 | 功能 | |------|------|------| | /api/muv-engine/expand-macros | POST | 服务端展开宏(random/pick/roll) | | /api/muv-engine/reroll-pick | POST | 清除 pick 缓存 | | /api/muv-engine/apply-regex | POST | 对文本执行正则脚本 | | /api/muv-engine/apply-regex-card | POST | 从卡片 JSON 执行正则(生效脚本集 = 全局先 + 卡级后) | | /api/muv-engine/global-regex | GET/POST/DELETE | 全局正则脚本库:列出 / 导入(ST 导出件宽容解析)/ 删除 | | /api/muv-engine/state | GET/POST | 获取/更新变量状态 | | /api/muv-engine/extract | POST | 提取 <initvar> 并生成 MUV 块 | | /api/muv-engine/generate | POST | 编辑后生成 MUV 块 | | /api/muv-engine/status-bar | POST | 提取状态栏 HTML |

协议

PolyForm-Noncommercial-Copyleft-1.0.0 — 详见 LICENSE