dsh-chat-comprehension 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +20 -0
- package/README.md +20 -9
- package/client.js +30 -9
- package/lib/engines.mjs +136 -0
- package/lib/index.js +37 -4
- package/lib/qqbot-0.5.3-patches.json +75 -70
- package/lib/qqbot-patch.mjs +12 -7
- package/lib/video.mjs +11 -2
- package/package.json +7 -23
- package/vendor/dsh-agent-md/LICENSE +21 -0
- package/vendor/dsh-agent-md/cordis.patch.yml +8 -0
- package/vendor/dsh-agent-md/lib/index.js +775 -0
- package/vendor/dsh-agent-md/lib/persona.js +634 -0
- package/vendor/dsh-agent-md/lib/qq.js +527 -0
- package/vendor/dsh-agent-md/package.json +50 -0
- package/vendor/dsh-bili-scroll/LICENSE +21 -0
- package/vendor/dsh-bili-scroll/NOTICE.md +18 -0
- package/vendor/dsh-bili-scroll/cordis.patch.yml +20 -0
- package/vendor/dsh-bili-scroll/index.js +3278 -0
- package/vendor/dsh-bili-scroll/lib/asr.py +141 -0
- package/vendor/dsh-bili-scroll/lib/diagnose.mjs +95 -0
- package/vendor/dsh-bili-scroll/lib/dm.mjs +110 -0
- package/vendor/dsh-bili-scroll/lib/favops.py +90 -0
- package/vendor/dsh-bili-scroll/lib/hostdeps.mjs +148 -0
- package/vendor/dsh-bili-scroll/lib/login.mjs +141 -0
- package/vendor/dsh-bili-scroll/lib/mcp.mjs +144 -0
- package/vendor/dsh-bili-scroll/lib/state.mjs +236 -0
- package/vendor/dsh-bili-scroll/lib/uid.mjs +61 -0
- package/vendor/dsh-bili-scroll/lib/uvfetch.mjs +217 -0
- package/vendor/dsh-bili-scroll/lib/verify.mjs +184 -0
- package/vendor/dsh-bili-scroll/package.json +84 -0
- package/vendor/dsh-bili-scroll/profile-template/bili-duty/cordis.patch.yml +116 -0
- package/vendor/dsh-bili-scroll/profile-template/bili-duty/cordis.yml +4 -0
- package/vendor/dsh-bili-scroll/profile-template/bili-duty/package.json +13 -0
- package/vendor/dsh-bili-scroll/prompts/duty.md +296 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/LICENSE +21 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/README.md +176 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/mcp_server.py +2015 -0
- package/vendor/dsh-bili-scroll/vendor/bilibili-mcp/requirements.txt +10 -0
- package/vendor/dsh-meme/.dsh/skills/dsh-meme-maintenance/SKILL.md +50 -0
- package/vendor/dsh-meme/LICENSE +21 -0
- package/vendor/dsh-meme/anim.js +588 -0
- package/vendor/dsh-meme/cordis.patch.yml +13 -0
- package/vendor/dsh-meme/icon.jpg +0 -0
- package/vendor/dsh-meme/index.js +2616 -0
- package/vendor/dsh-meme/locale/en.json +6 -0
- package/vendor/dsh-meme/locale/zh.json +6 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/index.db +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/manifest.json +13 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/angry/shengqi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/baka/xianqi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/color/huachi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/confused/jiazai.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/confused/wenhao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/cpu/jiaban.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/daily/ganfan.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/fool/buyao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/givemoney/yaoqian.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/happy/deyi.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/happy/ok.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/happy/piaole.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/like/bixin.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/meow/maozhua.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/morning/zaoshanghao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sad/qiurao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sad/yun.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/see/zhenjing.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/shy/haixiu.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/shy/toukan.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sigh/wuyu.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/sleep/shuijiao.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/surprised/xia.jpg +0 -0
- package/vendor/dsh-meme/memes/dafeiyu-001/memes/work/tangping.jpg +0 -0
- package/vendor/dsh-meme/memes.js +998 -0
- package/vendor/dsh-meme/package.json +67 -0
- package/vendor/dsh-meme/panel.html +210 -0
- package/vendor/dsh-video-storyboard/LICENSE +21 -0
- package/vendor/dsh-video-storyboard/NOTICE +12 -0
- package/vendor/dsh-video-storyboard/bin/_args.mjs +16 -0
- package/vendor/dsh-video-storyboard/bin/asr-check.mjs +85 -0
- package/vendor/dsh-video-storyboard/bin/scan-stats.mjs +43 -0
- package/vendor/dsh-video-storyboard/bin/scan-video.mjs +38 -0
- package/vendor/dsh-video-storyboard/bin/storyboard.mjs +195 -0
- package/vendor/dsh-video-storyboard/cordis.patch.yml +3 -0
- package/vendor/dsh-video-storyboard/dsh.plugin.json +12 -0
- package/vendor/dsh-video-storyboard/package.json +88 -0
- package/vendor/dsh-video-storyboard/scripts/check-syntax.mjs +56 -0
- package/vendor/dsh-video-storyboard/scripts/install-dev.mjs +104 -0
- package/vendor/dsh-video-storyboard/src/flicker.js +104 -0
- package/vendor/dsh-video-storyboard/src/index.js +82 -0
- package/vendor/dsh-video-storyboard/src/ocr_bridge.py +103 -0
- package/vendor/dsh-video-storyboard/src/storyboard/asr-lifecycle.js +262 -0
- package/vendor/dsh-video-storyboard/src/storyboard/asr.js +488 -0
- package/vendor/dsh-video-storyboard/src/storyboard/audio.js +168 -0
- package/vendor/dsh-video-storyboard/src/storyboard/binaries.js +69 -0
- package/vendor/dsh-video-storyboard/src/storyboard/board.js +121 -0
- package/vendor/dsh-video-storyboard/src/storyboard/browser-time.js +504 -0
- package/vendor/dsh-video-storyboard/src/storyboard/cache.js +143 -0
- package/vendor/dsh-video-storyboard/src/storyboard/cells.js +70 -0
- package/vendor/dsh-video-storyboard/src/storyboard/density.js +545 -0
- package/vendor/dsh-video-storyboard/src/storyboard/direct-url.js +130 -0
- package/vendor/dsh-video-storyboard/src/storyboard/fetch.js +373 -0
- package/vendor/dsh-video-storyboard/src/storyboard/flash.js +180 -0
- package/vendor/dsh-video-storyboard/src/storyboard/format.js +573 -0
- package/vendor/dsh-video-storyboard/src/storyboard/frames.js +212 -0
- package/vendor/dsh-video-storyboard/src/storyboard/index.js +32 -0
- package/vendor/dsh-video-storyboard/src/storyboard/injection.js +76 -0
- package/vendor/dsh-video-storyboard/src/storyboard/layout-order.js +176 -0
- package/vendor/dsh-video-storyboard/src/storyboard/locate.js +113 -0
- package/vendor/dsh-video-storyboard/src/storyboard/media-store.js +106 -0
- package/vendor/dsh-video-storyboard/src/storyboard/memory.js +94 -0
- package/vendor/dsh-video-storyboard/src/storyboard/ocr-subs.js +107 -0
- package/vendor/dsh-video-storyboard/src/storyboard/ocr.js +167 -0
- package/vendor/dsh-video-storyboard/src/storyboard/pipeline.js +853 -0
- package/vendor/dsh-video-storyboard/src/storyboard/plan.js +400 -0
- package/vendor/dsh-video-storyboard/src/storyboard/probe.js +132 -0
- package/vendor/dsh-video-storyboard/src/storyboard/provenance.js +44 -0
- package/vendor/dsh-video-storyboard/src/storyboard/python.js +84 -0
- package/vendor/dsh-video-storyboard/src/storyboard/register.js +32 -0
- package/vendor/dsh-video-storyboard/src/storyboard/scan.js +486 -0
- package/vendor/dsh-video-storyboard/src/storyboard/segments.js +117 -0
- package/vendor/dsh-video-storyboard/src/storyboard/sheet.js +507 -0
- package/vendor/dsh-video-storyboard/src/storyboard/storage.js +93 -0
- package/vendor/dsh-video-storyboard/src/storyboard/subtitles.js +181 -0
- package/vendor/dsh-video-storyboard/src/storyboard/tool-spec.js +544 -0
- package/vendor/dsh-video-storyboard/src/storyboard/transcript-file.js +146 -0
- package/vendor/dsh-video-storyboard/src/storyboard/url.js +69 -0
- package/vendor/dsh-video-storyboard/src/storyboard/ytdlp.js +289 -0
- package/vendor/dsh-video-storyboard/src/tool-spec.js +17 -0
- package/vendor/dsh-video-storyboard/src/tools/locate.js +39 -0
- package/vendor/dsh-video-storyboard/src/tools/probe.js +23 -0
- package/vendor/dsh-video-storyboard/src/tools/shared.js +39 -0
- package/vendor/dsh-video-storyboard/src/tools/storyboard.js +20 -0
- package/vendor/dsh-video-storyboard/src/tools/zoom.js +56 -0
- package/vendor/dsh-world/LICENSE +21 -0
- package/vendor/dsh-world/assets/qq-card.png +0 -0
- package/vendor/dsh-world/cordis.patch.yml +6 -0
- package/vendor/dsh-world/lib/archive.d.ts +6 -0
- package/vendor/dsh-world/lib/archive.js +49 -0
- package/vendor/dsh-world/lib/archiveSelection.d.ts +8 -0
- package/vendor/dsh-world/lib/archiveSelection.js +20 -0
- package/vendor/dsh-world/lib/compaction.d.ts +124 -0
- package/vendor/dsh-world/lib/compaction.js +273 -0
- package/vendor/dsh-world/lib/compactionRegion.d.ts +42 -0
- package/vendor/dsh-world/lib/compactionRegion.js +210 -0
- package/vendor/dsh-world/lib/console/routes.d.ts +57 -0
- package/vendor/dsh-world/lib/console/routes.js +129 -0
- package/vendor/dsh-world/lib/console/snapshot.d.ts +39 -0
- package/vendor/dsh-world/lib/console/snapshot.js +51 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/bridge.d.ts +36 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/bridge.js +140 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/route.d.ts +9 -0
- package/vendor/dsh-world/lib/ecosystem/bridge/route.js +46 -0
- package/vendor/dsh-world/lib/ecosystem/qq/bridge.d.ts +123 -0
- package/vendor/dsh-world/lib/ecosystem/qq/bridge.js +380 -0
- package/vendor/dsh-world/lib/ecosystem/qq/panel.d.ts +75 -0
- package/vendor/dsh-world/lib/ecosystem/qq/panel.js +187 -0
- package/vendor/dsh-world/lib/ecosystem/qq/route.d.ts +32 -0
- package/vendor/dsh-world/lib/ecosystem/qq/route.js +134 -0
- package/vendor/dsh-world/lib/ecosystem/qq/supervisor.d.ts +57 -0
- package/vendor/dsh-world/lib/ecosystem/qq/supervisor.js +188 -0
- package/vendor/dsh-world/lib/ecosystem/shared/context.d.ts +14 -0
- package/vendor/dsh-world/lib/ecosystem/shared/context.js +42 -0
- package/vendor/dsh-world/lib/ecosystem/shared/identity.d.ts +15 -0
- package/vendor/dsh-world/lib/ecosystem/shared/identity.js +36 -0
- package/vendor/dsh-world/lib/ecosystem/shared/outlets.d.ts +43 -0
- package/vendor/dsh-world/lib/ecosystem/shared/outlets.js +70 -0
- package/vendor/dsh-world/lib/ecosystem/shared/sessions.d.ts +16 -0
- package/vendor/dsh-world/lib/ecosystem/shared/sessions.js +52 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/archive.d.ts +24 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/archive.js +62 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/home.d.ts +21 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/home.js +111 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/images.d.ts +5 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/images.js +43 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/index.d.ts +41 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/index.js +166 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/messages.d.ts +24 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/messages.js +35 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/sending.d.ts +30 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/sending.js +216 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/supervisor.d.ts +39 -0
- package/vendor/dsh-world/lib/ecosystem/wechat/supervisor.js +138 -0
- package/vendor/dsh-world/lib/faults.d.ts +10 -0
- package/vendor/dsh-world/lib/faults.js +13 -0
- package/vendor/dsh-world/lib/history.d.ts +16 -0
- package/vendor/dsh-world/lib/history.js +80 -0
- package/vendor/dsh-world/lib/hostContract.d.ts +19 -0
- package/vendor/dsh-world/lib/hostContract.js +1 -0
- package/vendor/dsh-world/lib/http.d.ts +18 -0
- package/vendor/dsh-world/lib/http.js +39 -0
- package/vendor/dsh-world/lib/index.d.ts +108 -0
- package/vendor/dsh-world/lib/index.js +356 -0
- package/vendor/dsh-world/lib/life/activity.d.ts +14 -0
- package/vendor/dsh-world/lib/life/activity.js +58 -0
- package/vendor/dsh-world/lib/life/alarm.d.ts +39 -0
- package/vendor/dsh-world/lib/life/alarm.js +132 -0
- package/vendor/dsh-world/lib/life/alarmTimer.d.ts +22 -0
- package/vendor/dsh-world/lib/life/alarmTimer.js +49 -0
- package/vendor/dsh-world/lib/life/diary.d.ts +4 -0
- package/vendor/dsh-world/lib/life/diary.js +9 -0
- package/vendor/dsh-world/lib/life/earlyStop.d.ts +19 -0
- package/vendor/dsh-world/lib/life/earlyStop.js +25 -0
- package/vendor/dsh-world/lib/life/home.d.ts +34 -0
- package/vendor/dsh-world/lib/life/home.js +91 -0
- package/vendor/dsh-world/lib/life/host.d.ts +22 -0
- package/vendor/dsh-world/lib/life/host.js +24 -0
- package/vendor/dsh-world/lib/life/journal.d.ts +20 -0
- package/vendor/dsh-world/lib/life/journal.js +59 -0
- package/vendor/dsh-world/lib/life/lifeStore.d.ts +16 -0
- package/vendor/dsh-world/lib/life/lifeStore.js +105 -0
- package/vendor/dsh-world/lib/life/messages.d.ts +17 -0
- package/vendor/dsh-world/lib/life/messages.js +53 -0
- package/vendor/dsh-world/lib/life/notify.d.ts +15 -0
- package/vendor/dsh-world/lib/life/notify.js +40 -0
- package/vendor/dsh-world/lib/life/pricing.d.ts +4 -0
- package/vendor/dsh-world/lib/life/pricing.js +30 -0
- package/vendor/dsh-world/lib/life/runtime.d.ts +52 -0
- package/vendor/dsh-world/lib/life/runtime.js +376 -0
- package/vendor/dsh-world/lib/life/toolRegistry.d.ts +22 -0
- package/vendor/dsh-world/lib/life/toolRegistry.js +64 -0
- package/vendor/dsh-world/lib/life/tools.d.ts +24 -0
- package/vendor/dsh-world/lib/life/tools.js +47 -0
- package/vendor/dsh-world/lib/life/types.d.ts +67 -0
- package/vendor/dsh-world/lib/life/types.js +1 -0
- package/vendor/dsh-world/lib/persona.d.ts +10 -0
- package/vendor/dsh-world/lib/persona.js +29 -0
- package/vendor/dsh-world/lib/promptSection.d.ts +30 -0
- package/vendor/dsh-world/lib/promptSection.js +81 -0
- package/vendor/dsh-world/lib/qqScope.d.ts +11 -0
- package/vendor/dsh-world/lib/qqScope.js +39 -0
- package/vendor/dsh-world/lib/runtime.d.ts +23 -0
- package/vendor/dsh-world/lib/runtime.js +206 -0
- package/vendor/dsh-world/lib/self.d.ts +10 -0
- package/vendor/dsh-world/lib/self.js +36 -0
- package/vendor/dsh-world/lib/sourceArchive.d.ts +28 -0
- package/vendor/dsh-world/lib/sourceArchive.js +156 -0
- package/vendor/dsh-world/lib/store.d.ts +30 -0
- package/vendor/dsh-world/lib/store.js +191 -0
- package/vendor/dsh-world/lib/timeContext.d.ts +3 -0
- package/vendor/dsh-world/lib/timeContext.js +13 -0
- package/vendor/dsh-world/lib/types.d.ts +118 -0
- package/vendor/dsh-world/lib/types.js +1 -0
- package/vendor/dsh-world/lib/worldPrompt.d.ts +47 -0
- package/vendor/dsh-world/lib/worldPrompt.js +49 -0
- package/vendor/dsh-world/lib/worldSwitch.d.ts +44 -0
- package/vendor/dsh-world/lib/worldSwitch.js +78 -0
- package/vendor/dsh-world/package-lock.json +1088 -0
- package/vendor/dsh-world/package.json +88 -0
- package/vendor/dsh-world/scripts/enable-tool-free-compaction.ps1 +33 -0
- package/vendor/dsh-world/src/archive.ts +45 -0
- package/vendor/dsh-world/src/archiveSelection.ts +27 -0
- package/vendor/dsh-world/src/compaction.ts +260 -0
- package/vendor/dsh-world/src/compactionRegion.ts +172 -0
- package/vendor/dsh-world/src/console/routes.ts +125 -0
- package/vendor/dsh-world/src/console/snapshot.ts +84 -0
- package/vendor/dsh-world/src/ecosystem/README.md +14 -0
- package/vendor/dsh-world/src/ecosystem/bridge/bridge.ts +121 -0
- package/vendor/dsh-world/src/ecosystem/bridge/route.ts +35 -0
- package/vendor/dsh-world/src/ecosystem/qq/bridge.ts +456 -0
- package/vendor/dsh-world/src/ecosystem/qq/panel.ts +178 -0
- package/vendor/dsh-world/src/ecosystem/qq/route.ts +130 -0
- package/vendor/dsh-world/src/ecosystem/qq/supervisor.ts +262 -0
- package/vendor/dsh-world/src/ecosystem/shared/context.ts +38 -0
- package/vendor/dsh-world/src/ecosystem/shared/identity.ts +42 -0
- package/vendor/dsh-world/src/ecosystem/shared/outlets.ts +75 -0
- package/vendor/dsh-world/src/ecosystem/shared/sessions.ts +47 -0
- package/vendor/dsh-world/src/ecosystem/wechat/archive.ts +66 -0
- package/vendor/dsh-world/src/ecosystem/wechat/home.ts +94 -0
- package/vendor/dsh-world/src/ecosystem/wechat/images.ts +38 -0
- package/vendor/dsh-world/src/ecosystem/wechat/index.ts +101 -0
- package/vendor/dsh-world/src/ecosystem/wechat/messages.ts +43 -0
- package/vendor/dsh-world/src/ecosystem/wechat/sending.ts +177 -0
- package/vendor/dsh-world/src/ecosystem/wechat/supervisor.ts +116 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/README.md +117 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/adapter.py +572 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/binding.py +52 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/LICENSE +43 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/NOTICE.md +10 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/bridge.cpp +229 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/build.ps1 +19 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/engine/profile.json +28 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/groups.py +42 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/incoming.py +157 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/native.py +168 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/outgoing.py +95 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/requirements.txt +1 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/sender.py +157 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/snapshot.py +32 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/stickers.py +60 -0
- package/vendor/dsh-world/src/ecosystem/wechat/windows/wechat.ps1 +75 -0
- package/vendor/dsh-world/src/faults.ts +12 -0
- package/vendor/dsh-world/src/history.ts +77 -0
- package/vendor/dsh-world/src/hostContract.ts +9 -0
- package/vendor/dsh-world/src/http.ts +34 -0
- package/vendor/dsh-world/src/index.ts +286 -0
- package/vendor/dsh-world/src/life/activity.ts +48 -0
- package/vendor/dsh-world/src/life/alarm.ts +119 -0
- package/vendor/dsh-world/src/life/alarmTimer.ts +45 -0
- package/vendor/dsh-world/src/life/diary.ts +10 -0
- package/vendor/dsh-world/src/life/earlyStop.ts +27 -0
- package/vendor/dsh-world/src/life/home.ts +85 -0
- package/vendor/dsh-world/src/life/host.ts +50 -0
- package/vendor/dsh-world/src/life/journal.ts +44 -0
- package/vendor/dsh-world/src/life/lifeStore.ts +70 -0
- package/vendor/dsh-world/src/life/messages.ts +44 -0
- package/vendor/dsh-world/src/life/notify.ts +47 -0
- package/vendor/dsh-world/src/life/pricing.ts +37 -0
- package/vendor/dsh-world/src/life/runtime.ts +318 -0
- package/vendor/dsh-world/src/life/toolRegistry.ts +48 -0
- package/vendor/dsh-world/src/life/tools.ts +61 -0
- package/vendor/dsh-world/src/life/types.ts +19 -0
- package/vendor/dsh-world/src/persona.ts +26 -0
- package/vendor/dsh-world/src/promptSection.ts +71 -0
- package/vendor/dsh-world/src/qqScope.ts +51 -0
- package/vendor/dsh-world/src/runtime.ts +172 -0
- package/vendor/dsh-world/src/self.ts +32 -0
- package/vendor/dsh-world/src/sourceArchive.ts +132 -0
- package/vendor/dsh-world/src/store.ts +170 -0
- package/vendor/dsh-world/src/timeContext.ts +13 -0
- package/vendor/dsh-world/src/types.ts +112 -0
- package/vendor/dsh-world/src/worldPrompt.ts +64 -0
- package/vendor/dsh-world/src/worldSwitch.ts +82 -0
- package/vendor/dsh-world/templates/alarm.md +49 -0
- package/vendor/dsh-world/templates/world-prompt.md +7 -0
- package/vendor/dsh-world/tests/archive.test.ts +57 -0
- package/vendor/dsh-world/tests/archiveScope.test.ts +86 -0
- package/vendor/dsh-world/tests/bridge.test.ts +211 -0
- package/vendor/dsh-world/tests/channelSessions.test.ts +79 -0
- package/vendor/dsh-world/tests/clientHooks.test.ts +103 -0
- package/vendor/dsh-world/tests/compaction.test.ts +141 -0
- package/vendor/dsh-world/tests/console.test.ts +202 -0
- package/vendor/dsh-world/tests/consoleClient.test.ts +101 -0
- package/vendor/dsh-world/tests/enableCompaction.test.ts +19 -0
- package/vendor/dsh-world/tests/fixtures.ts +6 -0
- package/vendor/dsh-world/tests/history.test.ts +100 -0
- package/vendor/dsh-world/tests/hostFixture.ts +46 -0
- package/vendor/dsh-world/tests/lifeActivity.test.ts +70 -0
- package/vendor/dsh-world/tests/lifeAlarm.test.ts +87 -0
- package/vendor/dsh-world/tests/lifeDiary.test.ts +33 -0
- package/vendor/dsh-world/tests/lifeMessages.test.ts +61 -0
- package/vendor/dsh-world/tests/lifeNotify.test.ts +46 -0
- package/vendor/dsh-world/tests/lifeParts.test.ts +45 -0
- package/vendor/dsh-world/tests/lifeRuntime.test.ts +660 -0
- package/vendor/dsh-world/tests/lifeStore.test.ts +90 -0
- package/vendor/dsh-world/tests/lifeTools.test.ts +53 -0
- package/vendor/dsh-world/tests/outlets.test.ts +85 -0
- package/vendor/dsh-world/tests/panel.test.ts +85 -0
- package/vendor/dsh-world/tests/plugin.test.ts +614 -0
- package/vendor/dsh-world/tests/pricing.test.ts +21 -0
- package/vendor/dsh-world/tests/qq.test.ts +121 -0
- package/vendor/dsh-world/tests/qqSessionMode.test.ts +97 -0
- package/vendor/dsh-world/tests/qqSupervisor.test.ts +149 -0
- package/vendor/dsh-world/tests/sourceArchive.test.ts +58 -0
- package/vendor/dsh-world/tests/store.test.ts +82 -0
- package/vendor/dsh-world/tests/storeWriter.ts +5 -0
- package/vendor/dsh-world/tests/timeContext.test.ts +15 -0
- package/vendor/dsh-world/tests/wechat.test.ts +254 -0
- package/vendor/dsh-world/tests/wechatImages.test.ts +130 -0
- package/vendor/dsh-world/tests/wechatSending.test.ts +142 -0
- package/vendor/dsh-world/tests/wechatSupervisor.test.ts +91 -0
- package/vendor/dsh-world/tests/worldPrompt.test.ts +201 -0
- package/vendor/dsh-world/tsconfig.build.json +5 -0
- package/vendor/dsh-world/tsconfig.json +8 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
asr.py —— 把一条 B站 视频(或本地音视频文件)转成文字。
|
|
5
|
+
给"这个视频没有字幕、但又值得判断"的情况用。
|
|
6
|
+
|
|
7
|
+
用法(在插件的 ASR 环境里跑):
|
|
8
|
+
.venv-asr/Scripts/python.exe asr.py BV1xxxxxxxxx # Windows
|
|
9
|
+
.venv-asr/bin/python asr.py https://www.bilibili.com/video/BV1xx
|
|
10
|
+
.venv-asr/Scripts/python.exe asr.py D:\\some\\clip.mp4 -o out.txt
|
|
11
|
+
…还可以加 --model small / --model medium 换模型(默认 small)
|
|
12
|
+
|
|
13
|
+
设计上的两个要点:
|
|
14
|
+
① **模型走国内镜像**(HF_ENDPOINT=hf-mirror.com)—— 否则 HuggingFace 拉不动
|
|
15
|
+
② **音频不落盘到别处**:yt-dlp 下到临时目录,转写完就随系统清理
|
|
16
|
+
"""
|
|
17
|
+
import argparse
|
|
18
|
+
import os
|
|
19
|
+
import re
|
|
20
|
+
import sys
|
|
21
|
+
import tempfile
|
|
22
|
+
|
|
23
|
+
# ⭐ Windows 上 Python 默认按 GBK 编/解码标准输出 —— 中文或 emoji 打进管道会直接炸
|
|
24
|
+
# (有用户反馈装依赖 / 跑转写时报 UnicodeDecodeError 或乱码)⇒ 这里钉死 UTF-8
|
|
25
|
+
try:
|
|
26
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
27
|
+
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
|
28
|
+
except Exception:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
# ⚠️ 临时目录必须待在家目录里:值班那一轮跑在沙箱里(只允许写工作区/cwd),
|
|
32
|
+
# yt-dlp 默认往 %TEMP% 写、会被直接拒掉(2026-10-14 在主人机器上实证:
|
|
33
|
+
# yt_dlp DownloadError: unable to open for writing: [Errno 13] Permission denied)
|
|
34
|
+
_HOME = os.path.dirname(os.path.abspath(__file__))
|
|
35
|
+
_TMP = os.path.join(_HOME, 'tmp', 'asr')
|
|
36
|
+
try:
|
|
37
|
+
os.makedirs(_TMP, exist_ok=True)
|
|
38
|
+
tempfile.tempdir = _TMP
|
|
39
|
+
except Exception:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
# ⭐ 必须在 import faster_whisper **之前**设好,否则它已经去连 HuggingFace 了
|
|
43
|
+
os.environ.setdefault('HF_ENDPOINT', 'https://hf-mirror.com')
|
|
44
|
+
# 模型缓存放本脚本所在目录(= 插件家):默认的 ~/.cache 在本机拒绝写入
|
|
45
|
+
os.environ.setdefault('HF_HOME', os.path.join(os.path.dirname(os.path.abspath(__file__)), '.hf-cache'))
|
|
46
|
+
# HuggingFace 新版存储(Xet)国内镜像不代理 ⇒ 关掉它,走老 CDN 通道(否则 401)
|
|
47
|
+
os.environ.setdefault('HF_HUB_DISABLE_XET', '1')
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_url(target: str) -> str:
|
|
51
|
+
t = target.strip()
|
|
52
|
+
if t.upper().startswith('BV') and len(t) <= 20:
|
|
53
|
+
return 'https://www.bilibili.com/video/' + t
|
|
54
|
+
return t
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def fetch_audio(url: str, tmp: str, tag: str) -> str:
|
|
58
|
+
"""用 yt-dlp 把音频拉下来(B站 是 DASH 音视频分离,取 bestaudio 即可,不需要 ffmpeg 合并)"""
|
|
59
|
+
from yt_dlp import YoutubeDL
|
|
60
|
+
opts = {
|
|
61
|
+
'format': 'bestaudio/best',
|
|
62
|
+
'outtmpl': os.path.join(tmp, tag + '.%(ext)s'), # ⭐ 用 BV 号当文件名:固定名会和别的轮次撞车(踩过)
|
|
63
|
+
'paths': {'home': tmp, 'temp': tmp}, # 别让 yt-dlp 往 %TEMP% 写(沙箱会拒)
|
|
64
|
+
'cachedir': False, # 顺手别去动用户目录里的缓存
|
|
65
|
+
# ⭐ nopart:不写 .part 再改名,直接落最终文件。
|
|
66
|
+
# 沙箱里"新建文件 + 改名"会被拒,而这条能绕开(2026-10-14 值班那一轮自己试出来的)
|
|
67
|
+
'nopart': True,
|
|
68
|
+
# [2026-10-20 · 参考社区 PR #23] 进度条默认打到 stdout ⇒ 调用方"stdout 非空=成功"恒真 ✗
|
|
69
|
+
# 我们是读文件走的,把进度关掉,别污染输出
|
|
70
|
+
'noprogress': True,
|
|
71
|
+
'quiet': True,
|
|
72
|
+
'no_warnings': True,
|
|
73
|
+
'noplaylist': True,
|
|
74
|
+
'http_headers': {
|
|
75
|
+
'Referer': 'https://www.bilibili.com',
|
|
76
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
with YoutubeDL(opts) as ydl:
|
|
80
|
+
info = ydl.extract_info(url, download=True)
|
|
81
|
+
return ydl.prepare_filename(info)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def main() -> int:
|
|
85
|
+
ap = argparse.ArgumentParser(description='把一条视频转成文字(默认中文)')
|
|
86
|
+
ap.add_argument('target', help='BV 号 / B站链接 / 本地音视频文件')
|
|
87
|
+
ap.add_argument('-o', '--out', help='写到这个文件(不给就打到标准输出)')
|
|
88
|
+
ap.add_argument('--model', default=os.environ.get('BILI_DUTY_ASR_MODEL', 'small'),
|
|
89
|
+
help='Whisper 模型大小:tiny / base / small / medium(默认 small)')
|
|
90
|
+
ap.add_argument('--lang', default='zh', help='语言(默认 zh;不给就自动判断请传 auto)')
|
|
91
|
+
args = ap.parse_args()
|
|
92
|
+
|
|
93
|
+
src = args.target
|
|
94
|
+
# ⚠️ 不用 mkdtemp:沙箱只允许写"子进程启动前就存在"的目录,新建的会被拒 ✗
|
|
95
|
+
# 这个目录由宿主(插件)预先建好;文件名固定,跑完自己清掉
|
|
96
|
+
tmp = _TMP
|
|
97
|
+
# ⭐ 每个视频用**自己的**文件名:以前写死 audio.m4a ⇒ 两轮同时跑会互相覆盖,
|
|
98
|
+
# 上一轮转出来的其实是另一个视频的内容(2026-10-14 值班那轮亲踩 ✗)
|
|
99
|
+
tag = os.path.basename(src).rsplit('.', 1)[0] or 'clip'
|
|
100
|
+
tag = re.sub(r'[^0-9A-Za-z_-]', '_', tag)[:40] or 'clip'
|
|
101
|
+
try:
|
|
102
|
+
if src.lower().startswith('http') or src.upper().startswith('BV'):
|
|
103
|
+
print('[asr] 先下音频…', file=sys.stderr)
|
|
104
|
+
src = fetch_audio(to_url(src), tmp, tag)
|
|
105
|
+
if not os.path.exists(src):
|
|
106
|
+
print('[asr] 找不到文件:' + src, file=sys.stderr)
|
|
107
|
+
return 2
|
|
108
|
+
|
|
109
|
+
from faster_whisper import WhisperModel
|
|
110
|
+
print('[asr] 加载模型 %s(第一次会自动下模型,之后就是本地读)…' % args.model, file=sys.stderr)
|
|
111
|
+
model = WhisperModel(args.model, device='cpu', compute_type='int8')
|
|
112
|
+
print('[asr] 开始转写…', file=sys.stderr)
|
|
113
|
+
segments, _info = model.transcribe(
|
|
114
|
+
src,
|
|
115
|
+
language=None if args.lang == 'auto' else args.lang,
|
|
116
|
+
vad_filter=True, # 掐掉静音段,省时间也少出错
|
|
117
|
+
)
|
|
118
|
+
text = ''.join(seg.text for seg in segments).strip()
|
|
119
|
+
finally:
|
|
120
|
+
# 临时音频不留在磁盘上
|
|
121
|
+
try:
|
|
122
|
+
import glob
|
|
123
|
+
for f in glob.glob(os.path.join(tmp, tag + '.*')):
|
|
124
|
+
try:
|
|
125
|
+
os.remove(f)
|
|
126
|
+
except Exception:
|
|
127
|
+
pass
|
|
128
|
+
except Exception:
|
|
129
|
+
pass
|
|
130
|
+
|
|
131
|
+
if args.out:
|
|
132
|
+
with open(args.out, 'w', encoding='utf-8') as f:
|
|
133
|
+
f.write(text)
|
|
134
|
+
print('[asr] 已写入:' + args.out, file=sys.stderr)
|
|
135
|
+
else:
|
|
136
|
+
print(text)
|
|
137
|
+
return 0
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if __name__ == '__main__':
|
|
141
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把"这一轮为什么没跑起来"从日志尾部翻成人话。
|
|
3
|
+
*
|
|
4
|
+
* 起因(2026-10-24 一位桌面版用户实测):
|
|
5
|
+
* `dsh: NO_ADAPTER: no adapter registered for provider "baomiao-oneapi"`
|
|
6
|
+
* ⇒ 那一轮 1 秒就 exit 1,报告里只有一行 code=1 ⇒ 用户看不懂,以为插件坏了。
|
|
7
|
+
*
|
|
8
|
+
* 设计约束(刻意压到最小面积):
|
|
9
|
+
* · **纯函数**:只吃一段字符串、吐一个对象(或 null),不读文件、不写文件、不抛异常;
|
|
10
|
+
* · **只在"报告本来该有却没有"时被调用**(跑通的那条路根本不经过它);
|
|
11
|
+
* · **认不出来就返回 null** ⇒ 调用方走原来的兜底文案,行为跟以前完全一样。
|
|
12
|
+
*
|
|
13
|
+
* @param {string} tail 这一轮日志的尾部(几百~几千字即可)
|
|
14
|
+
* @returns {{ title: string, body: string, hint?: string } | null}
|
|
15
|
+
*/
|
|
16
|
+
export function diagnoseRound(tail) {
|
|
17
|
+
const t = String(tail || '')
|
|
18
|
+
if (!t) return null
|
|
19
|
+
|
|
20
|
+
// ① 模型提供方没有驱动 —— 最常见的"配了第三方中转、但那个 profile 没装对应插件"
|
|
21
|
+
const noAdapter =
|
|
22
|
+
t.match(/no adapter registered for provider\s+"([^"]+)"/i) ||
|
|
23
|
+
t.match(/NO_ADAPTER[^\n]*provider\s+"([^"]+)"/i)
|
|
24
|
+
if (noAdapter) {
|
|
25
|
+
const p = String(noAdapter[1] || '').trim()
|
|
26
|
+
return {
|
|
27
|
+
title: `这一轮的模型提供方没注册驱动:${p}`,
|
|
28
|
+
hint: 'NO_ADAPTER',
|
|
29
|
+
body: [
|
|
30
|
+
`它一启动就退出了 —— 不是不会刷,而是**那一轮要用的模型提供方 \`${p}\`,在它跑的那个 profile 里没有对应的驱动(adapter)**。`,
|
|
31
|
+
'',
|
|
32
|
+
'提供方的"配置"可能是全局的,但"注册这个提供方的驱动"是**每个 profile 各装各的** —— 主 profile 装了,不等于跑这一轮的 profile 也有。',
|
|
33
|
+
'',
|
|
34
|
+
'**怎么办(任选一种):**',
|
|
35
|
+
'',
|
|
36
|
+
'1. **最省事**:把那个 profile 的模型改回官方 —— 编辑 `~/.dsh/profiles/headless/cordis.patch.yml`(2.1.0 起是 `bili-duty`),加上:',
|
|
37
|
+
'',
|
|
38
|
+
' ```yaml',
|
|
39
|
+
' provider: deepseek-official',
|
|
40
|
+
' model: deepseek-flash',
|
|
41
|
+
' ```',
|
|
42
|
+
'',
|
|
43
|
+
' 或者在设置页「刷B站 → 高级 → headless profile」里,指到一个已经配好官方模型的 profile。',
|
|
44
|
+
`2. **继续用 \`${p}\`**:把注册它的那个提供方插件,也装进这个 profile。`,
|
|
45
|
+
'',
|
|
46
|
+
'> 这类失败是**环境配置**,不是插件坏了。改完不用重装插件,直接再点一次「现在跑一轮」。',
|
|
47
|
+
].join('\n'),
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ② 没有可用凭据
|
|
52
|
+
if (/MISSING_CREDENTIAL|missing credential|no api key|Unauthorized|E401|\b401\b/i.test(t)) {
|
|
53
|
+
return {
|
|
54
|
+
title: '这一轮没有可用的模型凭据',
|
|
55
|
+
hint: 'NO_CREDENTIAL',
|
|
56
|
+
body: [
|
|
57
|
+
'它启动后没能拿到模型凭据就退了。',
|
|
58
|
+
'',
|
|
59
|
+
'**怎么办**:去 DSH 设置里确认已登录 / 已填 API key,然后再跑一次。',
|
|
60
|
+
'凭据是宿主那一层的事,插件读不到、也不该替用户填。',
|
|
61
|
+
].join('\n'),
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ③ 找不到 dsh(桌面版常见)
|
|
66
|
+
if (/9009|不是内部或外部命令|could not be found|cannot find the file|ENOENT/i.test(t) === true &&
|
|
67
|
+
/dsh/i.test(t)) {
|
|
68
|
+
return {
|
|
69
|
+
title: '这一轮找不到 dsh 可执行文件',
|
|
70
|
+
hint: 'NO_DSH',
|
|
71
|
+
body: [
|
|
72
|
+
'桌面版多半不是 npm 全局安装,PATH 里没有 `dsh`。',
|
|
73
|
+
'',
|
|
74
|
+
'**怎么办**:在设置页把「dsh 路径」指到应用目录里的 `@deepseek-ai/dsh/lib/bin.js`;插件日志里会写出它试过的位置。',
|
|
75
|
+
].join('\n'),
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ④ 提示词变量没有值
|
|
80
|
+
// ⚠️ 变量名可能长成 `{{model}}` 这种带花括号的写法 ⇒ 字符类里必须放行 {} $
|
|
81
|
+
const noVar = t.match(/prompt variable\s+"?([\w.{}$-]+)"?\s+has no value/i)
|
|
82
|
+
if (noVar) {
|
|
83
|
+
return {
|
|
84
|
+
title: `提示词变量 \`${noVar[1]}\` 没有值`,
|
|
85
|
+
hint: 'NO_VAR',
|
|
86
|
+
body: [
|
|
87
|
+
'多半是那个 profile 的模型 / 会话没绑好。',
|
|
88
|
+
'',
|
|
89
|
+
'**怎么办**:换一个新会话,或重启一次 DSH 再试。',
|
|
90
|
+
].join('\n'),
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return null
|
|
95
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/dm.mjs —— B站 私信:读会话 / 读消息 / 发消息
|
|
3
|
+
*
|
|
4
|
+
* 为什么要它(2026-10-21 起):「私信双向」= 使用者在 B站 私信里跟它说话,它能看见并回一句。
|
|
5
|
+
* 接口是 2026-10-19 实测通过的(见记忆):**只读、纯代码**,不花 token;
|
|
6
|
+
* 只有真有人发来新消息时才去唤醒模型,所以平时零成本 ✓
|
|
7
|
+
*
|
|
8
|
+
* 接口(都要带登录 Cookie,且 GET):
|
|
9
|
+
* ① 列会话:/session_svr/v1/session_svr/get_sessions?session_type=1&group_id=0&Build=0&mobi_app=web
|
|
10
|
+
* ② 读消息:/svr_sync/v1/svr_sync/fetch_session_msgs?talker_id=<uid>&session_type=1&size=<n>&build=0&mobi_app=web
|
|
11
|
+
* ③ 发消息:走 vendor 里的 bili_send_message(不在这份文件里)
|
|
12
|
+
* ⚠️ 别用 /x/im/web/session/list(404)、/get_msgs(404)、fetch_session_msgs 用 POST(405)
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
15
|
+
import { join } from 'node:path'
|
|
16
|
+
|
|
17
|
+
const UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0 Safari/537.36'
|
|
18
|
+
|
|
19
|
+
export function loadCred(stateDir) {
|
|
20
|
+
const f = join(stateDir, 'bili_credential.json')
|
|
21
|
+
if (!existsSync(f)) return null
|
|
22
|
+
try {
|
|
23
|
+
const c = JSON.parse(readFileSync(f, 'utf8'))
|
|
24
|
+
return c?.sessdata ? c : null
|
|
25
|
+
} catch { return null }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function headers(cred) {
|
|
29
|
+
return {
|
|
30
|
+
'User-Agent': UA,
|
|
31
|
+
Referer: 'https://message.bilibili.com/',
|
|
32
|
+
Origin: 'https://message.bilibili.com',
|
|
33
|
+
Cookie: `SESSDATA=${cred.sessdata}; bili_jct=${cred.bili_jct}; buvid3=${cred.buvid3}`,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function jget(url, cred) {
|
|
38
|
+
const r = await fetch(url, { headers: headers(cred) })
|
|
39
|
+
const j = await r.json().catch(() => null)
|
|
40
|
+
if (!j || j.code !== 0) throw new Error(`HTTP ${r.status} code=${j?.code} msg=${j?.message || ''}`)
|
|
41
|
+
return j.data || {}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** 会话列表:[{ uid, unread, lastTs, preview }] */
|
|
45
|
+
export async function listSessions(cred) {
|
|
46
|
+
const d = await jget('https://api.vc.bilibili.com/session_svr/v1/session_svr/get_sessions?session_type=1&group_id=0&Build=0&mobi_app=web', cred)
|
|
47
|
+
const list = d.session_list || []
|
|
48
|
+
return list.map((s) => {
|
|
49
|
+
let preview = ''
|
|
50
|
+
try {
|
|
51
|
+
const c = s.last_msg?.content ? JSON.parse(s.last_msg.content) : null
|
|
52
|
+
preview = String(c?.content || c?.text || '').slice(0, 80)
|
|
53
|
+
} catch { /* 非 JSON 就留空 */ }
|
|
54
|
+
return {
|
|
55
|
+
uid: Number(s.talker_id) || 0,
|
|
56
|
+
unread: Number(s.unread_count) || 0,
|
|
57
|
+
lastTs: Number(s.last_msg?.timestamp) || 0,
|
|
58
|
+
preview,
|
|
59
|
+
}
|
|
60
|
+
}).filter((x) => x.uid > 0)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 读某个会话最近的 n 条:[{ key, ts, fromMe, text }] */
|
|
64
|
+
export async function fetchMsgs(cred, talkerId, size = 10) {
|
|
65
|
+
const url = `https://api.vc.bilibili.com/svr_sync/v1/svr_sync/fetch_session_msgs?talker_id=${Number(talkerId)}`
|
|
66
|
+
+ `&session_type=1&size=${Math.max(1, Math.min(50, size))}&build=0&mobi_app=web`
|
|
67
|
+
const d = await jget(url, cred)
|
|
68
|
+
const list = (d.messages || []).slice().reverse() // 接口是倒序的
|
|
69
|
+
return list.map((m) => {
|
|
70
|
+
const mt = Number(m.msg_type) || 1
|
|
71
|
+
let text = ''
|
|
72
|
+
let isCard = false
|
|
73
|
+
let imageUrl = ''
|
|
74
|
+
try {
|
|
75
|
+
const c = JSON.parse(m.content || '{}')
|
|
76
|
+
// ⭐ 2026-10-21:分享卡片是 msg_type=7(视频)/ 8,它的 content 里**没有 content 字段**,
|
|
77
|
+
// 只有 author / title / jump_url / thumb ⇒ 以前被当成"空消息"直接过滤掉,等于收不到分享 ✗
|
|
78
|
+
if ((mt === 7 || mt === 8) && (c.jump_url || c.bvid || c.author || c.title)) {
|
|
79
|
+
isCard = true
|
|
80
|
+
const bv = String(c.bvid || '') || (String(c.jump_url || '').match(/BV[0-9A-Za-z]{10}/) || [])[0] || ''
|
|
81
|
+
const title = String(c.title || c.headline || c.desc || '').slice(0, 80)
|
|
82
|
+
const who = String(c.author || '').slice(0, 30)
|
|
83
|
+
text = '[分享视频] ' + (title || '(无标题)') + (who ? ' / ' + who : '') + (bv ? ' ' + bv : '')
|
|
84
|
+
} else {
|
|
85
|
+
// B站 私信图片常见 msg_type=2;content 里是 url / image_url / thumb 之类
|
|
86
|
+
const img = c.url || c.image_url || c.img_url || c.thumb || c.cover || ''
|
|
87
|
+
if (mt === 2 || (img && !c.content && !c.text)) {
|
|
88
|
+
imageUrl = String(img || '')
|
|
89
|
+
text = '[图片]'
|
|
90
|
+
} else {
|
|
91
|
+
text = String(c.content || c.text || '')
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch { text = String(m.content || '') }
|
|
95
|
+
if (!text) text = imageUrl ? '[图片]' : '[非文字消息]'
|
|
96
|
+
return {
|
|
97
|
+
key: String(m.msg_key || m.msg_seqno || m.timestamp),
|
|
98
|
+
ts: Number(m.timestamp) || 0,
|
|
99
|
+
fromMe: Number(m.sender_uid) === Number(cred.dedeuserid),
|
|
100
|
+
kind: imageUrl ? 'image' : (isCard ? mt : 1),
|
|
101
|
+
imageUrl,
|
|
102
|
+
text: text.slice(0, 500),
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** 我自己的 uid(凭证里有) */
|
|
108
|
+
export function myUid(cred) {
|
|
109
|
+
return Number(cred?.dedeuserid) || 0
|
|
110
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""favops.py —— 「刷B站」的收藏边车(宿主直接调,不经过 MCP,模型拿不到这只手)
|
|
3
|
+
|
|
4
|
+
用法:
|
|
5
|
+
python favops.py folders # 列收藏夹 → 末行 JSON {"ok":true,"folders":[{id,title,count}]}
|
|
6
|
+
python favops.py add <bvid> <fid> # 收藏 → {"ok":true} / {"ok":false,"error":"..."}
|
|
7
|
+
"""
|
|
8
|
+
import asyncio
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
14
|
+
|
|
15
|
+
# 凭证找两处:优先**当前工作目录**(宿主 spawn 时 cwd = 插件家,凭证就在那儿),
|
|
16
|
+
# 退回脚本旁边(脚本被铺到插件家后两者一致)
|
|
17
|
+
CRED_CANDIDATES = [
|
|
18
|
+
os.path.join(os.getcwd(), 'bili_credential.json'),
|
|
19
|
+
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bili_credential.json'),
|
|
20
|
+
]
|
|
21
|
+
CRED_FILE = next((p for p in CRED_CANDIDATES if os.path.exists(p)), CRED_CANDIDATES[0])
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def out(obj):
|
|
25
|
+
print(json.dumps(obj, ensure_ascii=False))
|
|
26
|
+
sys.exit(0)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def load():
|
|
30
|
+
from bilibili_api import Credential
|
|
31
|
+
if not os.path.exists(CRED_FILE):
|
|
32
|
+
out({'ok': False, 'error': '还没扫码登录(bili_credential.json 不存在)'})
|
|
33
|
+
d = json.load(open(CRED_FILE, encoding='utf-8'))
|
|
34
|
+
return Credential(
|
|
35
|
+
sessdata=d['sessdata'],
|
|
36
|
+
bili_jct=d['bili_jct'],
|
|
37
|
+
buvid3=d.get('buvid3', ''),
|
|
38
|
+
dedeuserid=str(d['dedeuserid']),
|
|
39
|
+
), int(d['dedeuserid'])
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
async def folders():
|
|
43
|
+
from bilibili_api import favorite_list
|
|
44
|
+
cred, uid = load()
|
|
45
|
+
res = await favorite_list.get_video_favorite_list(uid, credential=cred)
|
|
46
|
+
items = (res or {}).get('list') or []
|
|
47
|
+
out({'ok': True, 'folders': [{'id': it.get('id'), 'title': it.get('title'), 'count': it.get('media_count', 0)} for it in items]})
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
async def add(bvid, fid):
|
|
51
|
+
from bilibili_api import video as ba_video
|
|
52
|
+
# ⭐ 必须在 add() 里也 import favorite_list —— 它只在 folders() 里 import 过一次,
|
|
53
|
+
# 而两个函数各自是独立作用域,所以下面两行用法会 NameError:
|
|
54
|
+
# 「自动收藏永远失败」的根因就是这个(issue #76)。
|
|
55
|
+
# 报错信息长得像"收藏接口坏了",但实际是这个名字根本没绑定。
|
|
56
|
+
from bilibili_api import favorite_list
|
|
57
|
+
cred, _ = load()
|
|
58
|
+
v = ba_video.Video(bvid=bvid, credential=cred)
|
|
59
|
+
info = await v.get_info()
|
|
60
|
+
aid = int(info['aid'])
|
|
61
|
+
# 保持原有行为:先取一次收藏夹信息(原代码就有,不要顺手删)
|
|
62
|
+
res = await favorite_list.FavoriteList(aid, credential=cred).get_info()
|
|
63
|
+
try:
|
|
64
|
+
await favorite_list.FavoriteListResource(aid, type_=2, credential=cred).add(fid)
|
|
65
|
+
except Exception as error: # noqa: BLE001
|
|
66
|
+
msg = str(error)
|
|
67
|
+
# 已经收藏过不算失败
|
|
68
|
+
if '已经' in msg or 'already' in msg.lower():
|
|
69
|
+
out({'ok': True, 'already': True})
|
|
70
|
+
out({'ok': False, 'error': msg[:200]})
|
|
71
|
+
out({'ok': True})
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def main():
|
|
75
|
+
args = sys.argv[1:]
|
|
76
|
+
if not args:
|
|
77
|
+
out({'ok': False, 'error': '没有子命令(folders / add)'})
|
|
78
|
+
try:
|
|
79
|
+
if args[0] == 'folders':
|
|
80
|
+
asyncio.run(folders())
|
|
81
|
+
elif args[0] == 'add' and len(args) >= 3:
|
|
82
|
+
asyncio.run(add(args[1], int(args[2])))
|
|
83
|
+
else:
|
|
84
|
+
out({'ok': False, 'error': '子命令不认识:' + ' '.join(args)})
|
|
85
|
+
except Exception as error: # noqa: BLE001
|
|
86
|
+
out({'ok': False, 'error': str(error)[:300]})
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == '__main__':
|
|
90
|
+
main()
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/hostdeps.mjs —— 从宿主那棵树里取 `@deepseek-ai/*`(拿不到就退到"自己的依赖")
|
|
3
|
+
* ============================================================================
|
|
4
|
+
* 🔴 为什么要有它(2026-10-16 一位用户递来的完整报告,本机也复现了):
|
|
5
|
+
* `index.js` 顶部裸 import `@deepseek-ai/schemastery` 和 `@deepseek-ai/dsh-tools`,
|
|
6
|
+
* 而它们在 package.json 里是 **optional peer** ⇒ 桌面版 profile(`autoInstallPeers: false`)
|
|
7
|
+
* **永远不装它们** ⇒ 插件整条不激活,DSH 只留一句
|
|
8
|
+
* `warning: 1 entry did not activate … failed to import` ✓
|
|
9
|
+
* (web profile 上之所以一直没事,是因为 profile 树里恰好有别的插件把它们 hoist 上来了 —— 这是运气 ✗)
|
|
10
|
+
* ⚠️ `dsh-tools` 自己还有 7 个顶层 import、其中 4 个是 peer ⇒ 光把它装上也救不回来 ✗。
|
|
11
|
+
*
|
|
12
|
+
* ⭐ 策略(两条一起走):
|
|
13
|
+
* ① **优先从宿主那棵树里解析**(跟宿主用同一份,行为最一致);
|
|
14
|
+
* ② 解析不到就 **bare import**(靠我们自己 package.json 的 `dependencies` 装一份保底);
|
|
15
|
+
* ③ `schemastery` 彻底拿不到 ⇒ 返回 null,**插件照常加载**(只是没有 Config、设置页降级)——
|
|
16
|
+
* **绝不因为一个 import 就让整条插件不激活** ✗✓。
|
|
17
|
+
* ============================================================================
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
20
|
+
import { join, dirname } from 'node:path'
|
|
21
|
+
import { homedir } from 'node:os'
|
|
22
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
23
|
+
|
|
24
|
+
/** 插件自己那棵树(`dependencies` 装出来的那份)—— 用模块位置算,别依赖 cwd */
|
|
25
|
+
const SELF_MODULES = join(dirname(fileURLToPath(import.meta.url)), '..', 'node_modules', '@deepseek-ai')
|
|
26
|
+
|
|
27
|
+
/** 可能藏着宿主 `@deepseek-ai` 包的地方(不写死某一台机器,按可能性排序) */
|
|
28
|
+
export function candidateRoots() {
|
|
29
|
+
const out = []
|
|
30
|
+
const push = (p) => { if (p && !out.includes(p)) out.push(p) }
|
|
31
|
+
push(process.env.DSH_HOST_MODULES)
|
|
32
|
+
|
|
33
|
+
const appdata = process.env.APPDATA
|
|
34
|
+
if (appdata) {
|
|
35
|
+
const npm = join(appdata, 'npm', 'node_modules')
|
|
36
|
+
push(join(npm, '@deepseek-ai', 'dsh', 'node_modules', '@deepseek-ai'))
|
|
37
|
+
push(join(npm, '@deepseek-ai'))
|
|
38
|
+
// 桌面版可能叫别的包名(dsh-desktop / dsh-next…)⇒ 逐个看它们的 node_modules
|
|
39
|
+
try {
|
|
40
|
+
for (const n of readdirSync(join(npm, '@deepseek-ai'))) {
|
|
41
|
+
push(join(npm, '@deepseek-ai', n, 'node_modules', '@deepseek-ai'))
|
|
42
|
+
}
|
|
43
|
+
} catch { /* 没有就算了 */ }
|
|
44
|
+
}
|
|
45
|
+
push('/usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai')
|
|
46
|
+
push('/usr/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai')
|
|
47
|
+
push('/usr/local/lib/node_modules/@deepseek-ai')
|
|
48
|
+
push('/usr/lib/node_modules/@deepseek-ai')
|
|
49
|
+
|
|
50
|
+
// profile 树:有些机器上这些包是被别的插件 hoist 到 profile 根上的
|
|
51
|
+
try {
|
|
52
|
+
const dshHome = process.env.DSH_HOME || join(homedir(), '.dsh')
|
|
53
|
+
for (const p of readdirSync(join(dshHome, 'profiles'))) {
|
|
54
|
+
push(join(dshHome, 'profiles', p, 'node_modules', '@deepseek-ai'))
|
|
55
|
+
}
|
|
56
|
+
} catch { /* 没有就算了 */ }
|
|
57
|
+
|
|
58
|
+
// 插件自己那份(package.json 的 dependencies 装出来的)—— 放最后,前面优先"跟宿主同一份"
|
|
59
|
+
push(SELF_MODULES)
|
|
60
|
+
return out
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 按包的 exports['.'] 找入口文件,返回 file:// URL */
|
|
64
|
+
function entryUrlFor(root, name) {
|
|
65
|
+
try {
|
|
66
|
+
const dir = join(root, name)
|
|
67
|
+
const pkgFile = join(dir, 'package.json')
|
|
68
|
+
if (!existsSync(pkgFile)) return null
|
|
69
|
+
const pkg = JSON.parse(readFileSync(pkgFile, 'utf8'))
|
|
70
|
+
const dot = pkg.exports?.['.']
|
|
71
|
+
const rel = typeof dot === 'string'
|
|
72
|
+
? dot
|
|
73
|
+
: (dot?.import || dot?.default || pkg.module || pkg.main)
|
|
74
|
+
if (!rel) return null
|
|
75
|
+
const file = join(dir, String(rel).replace(/^\.\//, ''))
|
|
76
|
+
return existsSync(file) ? pathToFileURL(file).href : null
|
|
77
|
+
} catch { return null }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 试从宿主树里 import 一个包;拿不到返回 null(失败原因写进 notes,方便远程排查) */
|
|
81
|
+
async function fromHostTree(name, log) {
|
|
82
|
+
const fails = []
|
|
83
|
+
for (const root of candidateRoots()) {
|
|
84
|
+
if (root === SELF_MODULES) continue // 自己那份交给下面的 bare import 处理
|
|
85
|
+
const url = entryUrlFor(root, name)
|
|
86
|
+
if (!url) continue
|
|
87
|
+
try {
|
|
88
|
+
const mod = await import(url)
|
|
89
|
+
log(`${name}:从宿主树取到(${url.replace(/^file:\/\/\//, '')})`)
|
|
90
|
+
return mod
|
|
91
|
+
} catch (e) { fails.push(`${e?.code || 'ERR'}:${root}`) }
|
|
92
|
+
}
|
|
93
|
+
if (fails.length) log(`${name}:宿主树里都不行(${fails.slice(0, 3).join(' ')})`)
|
|
94
|
+
return null
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** 从宿主树(或自己依赖)里取任意 `@deepseek-ai/*` 模块;拿不到返回 null。 */
|
|
98
|
+
export async function loadHostModule(name) {
|
|
99
|
+
const fromHost = await fromHostTree(name, () => {})
|
|
100
|
+
if (fromHost) return fromHost
|
|
101
|
+
try { return await import(name) } catch { return null }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 兜底:这是**我们自己的等价实现**,只在拿不到宿主的 dsh-tools 时用 */
|
|
105
|
+
function localDefineTool(options, log) {
|
|
106
|
+
// 宿主的 defineTool 会做 spec→JSONSchema 转换 + 参数校验;我们的 parameters / output.schema
|
|
107
|
+
// **本来就是标准 JSON Schema**(2026-10-14 那次 additionalProperties 报错就是被它校验出来的),
|
|
108
|
+
// 所以这里只补一条同样的校验,别的原样返回。
|
|
109
|
+
const check = (schema, where) => {
|
|
110
|
+
if (!schema || typeof schema !== 'object') return
|
|
111
|
+
if (schema.type === 'object' && schema.additionalProperties === undefined) {
|
|
112
|
+
throw new Error(`defineTool(${options.name}): ${where} 是 object 却没写 additionalProperties`)
|
|
113
|
+
}
|
|
114
|
+
for (const [k, v] of Object.entries(schema.properties || {})) check(v, `${where}.properties.${k}`)
|
|
115
|
+
}
|
|
116
|
+
check(options.parameters, 'parameters')
|
|
117
|
+
check(options.output?.schema, 'output.schema')
|
|
118
|
+
log?.(`dsh-tools 拿不到 —— 用本地等价实现顶上了(工具 ${options.name})`)
|
|
119
|
+
return options
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 取回宿主半端要用的一点点东西
|
|
124
|
+
* @returns {Promise<{z:any, defineTool:Function|null, notes:string[]}>}
|
|
125
|
+
*/
|
|
126
|
+
export async function loadHostDeps() {
|
|
127
|
+
const notes = []
|
|
128
|
+
const log = (m) => notes.push(m)
|
|
129
|
+
|
|
130
|
+
// ① schemastery(Config 要用;宿主设置层要用**它自己那份**读 volatile 字段)
|
|
131
|
+
let zMod = await fromHostTree('schemastery', log)
|
|
132
|
+
if (!zMod) {
|
|
133
|
+
try { zMod = await import('@deepseek-ai/schemastery'); log('schemastery:宿主树里没有,用自己依赖里那份') }
|
|
134
|
+
catch (e) { log(`⚠️ schemastery 彻底拿不到(${e?.code || ''} ${String(e?.message || '').slice(0, 120)})—— 这一份插件没有 Config,设置页会降级(插件本体照常跑)`) }
|
|
135
|
+
}
|
|
136
|
+
const z = zMod?.default ?? zMod ?? null
|
|
137
|
+
|
|
138
|
+
// ② dsh-tools 的 defineTool(拿不到就用本地等价实现 —— 这是本次桌面版修复的关键一步)
|
|
139
|
+
let defineTool = null
|
|
140
|
+
let dtMod = await fromHostTree('dsh-tools', log)
|
|
141
|
+
if (!dtMod) {
|
|
142
|
+
try { dtMod = await import('@deepseek-ai/dsh-tools'); log('dsh-tools:宿主树里没有,用自己依赖里那份') }
|
|
143
|
+
catch (e) { log(`dsh-tools 拿不到(${e?.code || ''})—— 用本地等价实现顶上`); dtMod = null }
|
|
144
|
+
}
|
|
145
|
+
defineTool = dtMod?.defineTool || ((options) => localDefineTool(options, log))
|
|
146
|
+
|
|
147
|
+
return { z, defineTool, notes }
|
|
148
|
+
}
|