MCPcopy Index your code
hub / github.com/N0VI028/JS-Slash-Runner

github.com/N0VI028/JS-Slash-Runner @4.8.14

Chat with this repo
repository ↗ · DeepWiki ↗ · release 4.8.14 ↗ · + Follow
4,465 symbols 17,367 edges 130 files 35 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Tavern-Helper

[!Warning] 执行自定义 JavaScript 代码, 可能会带来安全风险:

  • 恶意脚本可能会窃取你的 API 密钥、聊天记录等敏感信息; 修改或破坏你的 SillyTavern 设置
  • 某些脚本可能会执行危险操作, 如发送未经授权的请求

请在执行任何脚本前:

  1. 仔细检查脚本内容, 确保其来源可信
  2. 理解脚本的功能和可能的影响
  3. 如有疑问, 请勿执行来源不明的脚本

我们不为第三方脚本造成的任何损失负责.

此扩展允许你在 SillyTavern 中运行外部 JavaScript 代码

由于 SillyTavern 默认不支持直接执行 JavaScript 代码, 这个扩展通过使用 iframe 来隔离和执行脚本, 从而让你在某些受限的上下文中运行外部脚本.

文档

参与贡献提示

项目结构

基于酒馆 UI 插件的项目结构要求, 本项目直接打包源代码在 dist/ 文件夹中并随仓库上传, 而这会让开发时经常出现分支冲突.

为了解决这一点, 仓库在 .gitattribute 中设置了对于 dist/ 文件夹中的冲突总是使用当前版本. 这不会有什么问题: 在上传后, ci 会将 dist/ 文件夹重新打包成最新版本, 因而你上传的 dist/ 文件夹内容如何无关紧要.

为了启用这个功能, 请执行一次以下命令:

git config --global merge.ours.driver true

手动编译

你可以参考 参与前端插件开发的 VSCode 环境配置 来得到 VSCode 上更详细的配置和使用教程.

你需要先安装有 node 22+ 和 pnpm. 如果已经安装有 node 22+, 则 pnpm 可以按以下步骤安装:

npm install -g pnpm

然后, 用 pnpm 安装本项目的所有依赖:

pnpm install

之后你就可以对本项目进行编译:

pnpm build

或者, 你可以用 pnpm watch 来持续监听代码变动. 这样只需刷新酒馆网页, 酒馆就会使用最新的插件代码.

在 SillyTavern 目录外构建

默认情况下, 构建脚本通过 __dirname 中的 public 路径来计算 import 的相对路径, 因此项目需要位于 SillyTavern 的 public/scripts/extensions/third-party/ 下. 如果你希望将项目放在其他位置 (例如独立的仓库目录), 可以通过环境变量 ST_IMPORT_DEPTH 指定从 dist/ 到 SillyTavern public/ 根目录的目录层级数:

ST_IMPORT_DEPTH=5 pnpm build

层级数 5 对应 SillyTavern 的标准第三方扩展 URL 结构: scripts/extensions/third-party/<name>/dist/ → 5 层 ../ 回到 public/ 根. 构建完成后, 将 dist/lib/i18n/manifest.json 部署到 SillyTavern 的扩展目录即可, 也可以使用符号链接.

许可证

参考

见于文档对应部分

Extension points exported contracts — how you extend this code

ComponentCustomProperties (Interface)
(no doc)
src/index.ts
MacroLike (Interface)
(no doc)
src/function/macro_like.ts
ExpectedOption (Interface)
(no doc)
src/panel/optimize/disable_incompatible_option/index.ts
Window (Interface)
(no doc)
@types/function/index.d.ts
ListenerType (Interface)
(no doc)
@types/iframe/event.d.ts
MacroLikeContext (Interface)
(no doc)
src/function/macro_like.ts
RootVariablePayload (Interface)
(no doc)
src/panel/toolbox/variable_manager_deprecated/types.ts
ReplaceWorldbookOptions (Interface)
(no doc)
@types/function/worldbook.d.ts

Core symbols most depended-on inside this repo

Uc
called by 1518
lib/jsoneditor.js
gh
called by 433
lib/jsoneditor.js
Qc
called by 431
lib/jsoneditor.js
slice
called by 379
lib/jsoneditor.js
Ml
called by 374
lib/jsoneditor.js
map
called by 371
lib/jsoneditor.js
Uo
called by 362
lib/jsoneditor.js
e
called by 273
lib/jsoneditor.js

Shape

Function 2,476
Method 1,558
Class 417
Interface 14

Languages

TypeScript100%

Modules by API surface

lib/jsoneditor.js3,783 symbols
lib/tailwindcss.min.js190 symbols
src/function/persona.ts25 symbols
src/function/worldbook.ts21 symbols
src/function/raw_character.ts21 symbols
src/function/preset.ts21 symbols
src/function/chat_message.ts18 symbols
src/function/generate/responseGenerator.ts16 symbols
src/function/event.ts16 symbols
src/function/variables.ts15 symbols
src/function/generate/utils.ts15 symbols
src/function/generate/toolCallCompat.ts15 symbols

For agents

$ claude mcp add JS-Slash-Runner \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact