dsh-bili-scroll
c1overzz
DSH 插件:每天替你刷一轮 B站,读字幕挑出值得的、写一份日报,值得的 @ 你
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:kiwifruit13/dsh-jit-viewer
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DSH 平台插件 —— 在对话流中直接预览本机文档(PDF / Word / Excel / PPT / OFD / TXT / MD / CSV / HTML / 图片 / 视频),基于 jit-viewer SDK。
dsh plugin --profile web add @kiwifruit/dsh-jit-viewer
本包声明
dsh.bundle.patch与dsh.client.platform,安装后自动进入 bundle 层与 Web client 装载,重启dsh web生效。
当用户要求查看某个文档 / 文件,或你在了解上下文时需要打开某份文档时,调用
preview_document工具来在界面中预览它,不要用read/ 文本类工具读取二进制文档(会报二进制错)。
- 支持:
docx、doc、xlsx、xls、pptx、ppt、ofd、txt、md、markdown、csv、html、htm、png、jpg、jpeg、gif、webp、svg、bmp、mp4、webm。- 传入该文档的本地完整路径(
file);可选filename覆盖预览标题。- 若工具返回
ok:false(不支持类型 / 非法路径),直接告知用户"无法预览该文件",不要自行解析。- 预览由客户端打开浮窗渲染,你只需返回预览已触发的结果。
preview_document:注册到工具表,schema 校验必填 file,返回规范 JSON。preview_document 工具卡上的「预览」按钮 → 全屏浮窗,经宿主 HTTP 端点取文件并以 jit-viewer 渲染。随包内置 jit-viewer.min.js,离线可用。webServer exact 路由:GET /api/jit-viewer/pending-preview —— 当前已准入的待预览目标,返回 { file, name, type, previewMode }GET /api/jit-viewer/file?path= —— 从本地读取文件(带 safeServePath 校验:拒绝空 / NUL / .. 段),支持 Range 请求| 配置项 | 类型 | 默认 | 说明 |
|---|---|---|---|
theme |
"light" | "dark" |
"light" |
客户端查看器默认主题 |
配置经 Config(schemastery schema)校验,非法配置 fail loud,插件不启动。
tools、systemPrompt(硬,inject 声明);webServer(可选)。webServer 只在 web profile 下存在,所以不能写进 inject——那是硬依赖,非 web 宿主下 fiber 会一直 PENDING。ctx.get('webServer') + 判空降级。不能写成 ctx.webServer:ctx 是 Proxy,读到未声明的服务名会直接抛 cannot get property "webServer" without inject,后面的判空永远执行不到。preview_document,只是不挂 HTTP 端点(降级为无浏览器预览)。tool.call.toolview(key preview_document)、shell.overlay(id jit-viewer-preview)。peerDependencies 声明(@deepseek-ai/cordis / dsh-client-runtime)。npm install
npm run typecheck # tsc --noEmit
npm run build:host # tsc emit → lib/index.js + lib/index.d.ts(ESM)
npm run build:client # tsdown --config tsdown.client.config.ts → lib/client.js(CJS browser)
npm run build # typecheck + build:host + build:client
name / inject / Config / applymain / types / exports 指向 lib/ 产物cordis.patch.yml 用 scoped 包名 insertfiles 只含运行入口 / 声明 / patchctx.effect)Apache-2.0
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。