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,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/uvfetch.mjs —— 「机器上连 uv 和 Python 都没有」时,**插件自己把 uv 弄到手**
|
|
3
|
+
* ============================================================================
|
|
4
|
+
* 为什么值得单独做:uv 是**单个可执行文件**(Windows 上 ~32MB 的 uv.exe ✓),
|
|
5
|
+
* **解压就能用、不用管理员、不用进 PATH** ✓,而且它还能自己把 Python 拉下来 ✓
|
|
6
|
+
* ⇒ 只要拿到它,"首次安装"就从「先去装个 Python」变成「点一下就好」✓
|
|
7
|
+
*
|
|
8
|
+
* 两个源,按顺序试:
|
|
9
|
+
* ① **GitHub 官方 release**(`uv-x86_64-pc-windows-msvc.zip`)—— 有加速器时最快 ✓
|
|
10
|
+
* ② ⭐ **PyPI 清华镜像的 uv wheel** —— wheel 本身就是个 zip,里面装着 `uv.exe` ✓
|
|
11
|
+
* (国内速度快、不依赖 GitHub ✓)
|
|
12
|
+
*
|
|
13
|
+
* 解压:优先用 **系统自带的 `tar`**(Windows 10+ 的 bsdtar 能直接读 zip ✓),
|
|
14
|
+
* 再退到 `unzip`;然后**在解压出来的整棵树里按文件名找** ✓
|
|
15
|
+
* —— 不管官方把它放在哪一层都能找着 ✓
|
|
16
|
+
* ============================================================================
|
|
17
|
+
*/
|
|
18
|
+
import { spawnSync } from 'node:child_process'
|
|
19
|
+
import { createWriteStream, existsSync, mkdirSync, readdirSync, statSync, copyFileSync, chmodSync, rmSync, readFileSync } from 'node:fs'
|
|
20
|
+
import { createHash } from 'node:crypto'
|
|
21
|
+
import { join } from 'node:path'
|
|
22
|
+
import { Readable } from 'node:stream'
|
|
23
|
+
import { pipeline } from 'node:stream/promises'
|
|
24
|
+
|
|
25
|
+
/** 本机 Linux 是不是 musl libc(glibc 系统的 report header 会带 glibcVersionRuntime) */
|
|
26
|
+
function isMusl() {
|
|
27
|
+
if (process.platform !== 'linux') return false
|
|
28
|
+
try {
|
|
29
|
+
const v = process.report?.getReport?.()?.header?.glibcVersionRuntime
|
|
30
|
+
if (typeof v === 'string' && v.length) return false
|
|
31
|
+
} catch { /* 拿不到就继续,下面按动态链接器文件名判断 */ }
|
|
32
|
+
try {
|
|
33
|
+
return existsSync('/lib/ld-musl-aarch64.so.1') || existsSync('/lib/ld-musl-x86_64.so.1') || existsSync('/lib/ld-musl-i386.so.1')
|
|
34
|
+
} catch { return false }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 按 platform + arch 挑 uv 官方 release 的资产名(按优先级排序的候选列表)。
|
|
39
|
+
* 之前这里写死 x86_64(linux)/ aarch64(darwin)/ x86_64(win32)⇒ 别的架构会下错二进制,
|
|
40
|
+
* 解压后版本检查跑不起来(比如 arm64 机器拿到 x86-64 的包)。现在按 arch 选,linux 再把
|
|
41
|
+
* glibc/musl 各列一个候选,靠下面的版本检查兜底。
|
|
42
|
+
*/
|
|
43
|
+
function uvAssetCandidates() {
|
|
44
|
+
const p = process.platform
|
|
45
|
+
const a = process.arch
|
|
46
|
+
if (p === 'win32') {
|
|
47
|
+
if (a === 'arm64') return { bin: 'uv.exe', names: ['uv-aarch64-pc-windows-msvc.zip'] }
|
|
48
|
+
if (a === 'ia32') return { bin: 'uv.exe', names: ['uv-i686-pc-windows-msvc.zip'] }
|
|
49
|
+
return { bin: 'uv.exe', names: ['uv-x86_64-pc-windows-msvc.zip'] }
|
|
50
|
+
}
|
|
51
|
+
if (p === 'darwin') {
|
|
52
|
+
return a === 'arm64'
|
|
53
|
+
? { bin: 'uv', names: ['uv-aarch64-apple-darwin.tar.gz'] }
|
|
54
|
+
: { bin: 'uv', names: ['uv-x86_64-apple-darwin.tar.gz'] }
|
|
55
|
+
}
|
|
56
|
+
// linux(及其余落到这行的 unix);只列 uv 官方出资产的架构
|
|
57
|
+
const arch = {
|
|
58
|
+
x64: 'x86_64',
|
|
59
|
+
arm64: 'aarch64',
|
|
60
|
+
arm: 'armv7',
|
|
61
|
+
ia32: 'i686',
|
|
62
|
+
ppc64: 'powerpc64le',
|
|
63
|
+
s390x: 's390x',
|
|
64
|
+
riscv64: 'riscv64gc',
|
|
65
|
+
}[a]
|
|
66
|
+
if (!arch) return null
|
|
67
|
+
// armv7 的硬浮点是 gnueabihf / musleabihf,其余是 gnu / musl
|
|
68
|
+
const hf = arch === 'armv7' ? 'eabihf' : ''
|
|
69
|
+
const libcs = isMusl() ? ['musl', 'gnu'] : ['gnu', 'musl']
|
|
70
|
+
return { bin: 'uv', names: libcs.map((l) => `uv-${arch}-unknown-linux-${l}${hf}.tar.gz`) }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** 算一个文件的 sha256 */
|
|
74
|
+
function sha256Of(file) {
|
|
75
|
+
return createHash('sha256').update(readFileSync(file)).digest('hex')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 取"官方期望的 sha256":
|
|
80
|
+
* · PyPI wheel:JSON 里自带 `digests.sha256` ✓
|
|
81
|
+
* · GitHub 资产:同目录下有一份 `<文件名>.sha256` ✓(代理会一起转 ✓)
|
|
82
|
+
* 取不到就返回 null(那时只记一句"未校验",不拦着)
|
|
83
|
+
*/
|
|
84
|
+
async function expectedSha(source) {
|
|
85
|
+
if (source.sha) return String(source.sha).toLowerCase()
|
|
86
|
+
try {
|
|
87
|
+
const r = await fetch(source.url + '.sha256')
|
|
88
|
+
if (!r.ok) return null
|
|
89
|
+
const m = /([0-9a-f]{64})/i.exec(await r.text())
|
|
90
|
+
return m ? m[1].toLowerCase() : null
|
|
91
|
+
} catch { return null }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** 在目录树里按文件名找可执行文件(递归) */
|
|
95
|
+
export function findBin(name, dir) {
|
|
96
|
+
let entries = []
|
|
97
|
+
try { entries = readdirSync(dir, { withFileTypes: true }) } catch { return null }
|
|
98
|
+
for (const e of entries) {
|
|
99
|
+
const p = join(dir, e.name)
|
|
100
|
+
if (e.isDirectory()) { const hit = findBin(name, p); if (hit) return hit }
|
|
101
|
+
else if (e.name === name) return p
|
|
102
|
+
}
|
|
103
|
+
return null
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 解压一个压缩包并找出目标文件(tar 优先 —— Windows 自带那份能读 zip) */
|
|
107
|
+
export function extractArchive(binName, archive, into) {
|
|
108
|
+
const attempts = [['tar', ['-xf', archive, '-C', into]], ['unzip', ['-o', archive, '-d', into]]]
|
|
109
|
+
for (const [cmd, args] of attempts) {
|
|
110
|
+
try {
|
|
111
|
+
const r = spawnSync(cmd, args, { stdio: 'ignore' })
|
|
112
|
+
if (r.status === 0) { const hit = findBin(binName, into); if (hit) return hit }
|
|
113
|
+
} catch { /* 换下一个工具 */ }
|
|
114
|
+
}
|
|
115
|
+
return null
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 确保家目录里有一份可用的 uv,返回它的路径(拿不到就返回 null)。
|
|
120
|
+
* @param {{ dir: string, log?: (m: string) => void }} opts
|
|
121
|
+
*/
|
|
122
|
+
export async function ensureUv({ dir, log = () => {} }) {
|
|
123
|
+
const a = uvAssetCandidates()
|
|
124
|
+
if (!a) { log(`这台机器的平台/架构没有对应的 uv 官方资产(${process.platform} ${process.arch}),请手动放一份 uv 到 bin/`); return null }
|
|
125
|
+
const target = join(dir, a.bin)
|
|
126
|
+
if (existsSync(target)) return target
|
|
127
|
+
|
|
128
|
+
mkdirSync(dir, { recursive: true })
|
|
129
|
+
const tmp = join(dir, '_tmp')
|
|
130
|
+
rmSync(tmp, { recursive: true, force: true })
|
|
131
|
+
mkdirSync(tmp, { recursive: true })
|
|
132
|
+
|
|
133
|
+
// 源按顺序试:每个候选资产名 ×(直连 → 两个国内能用的 GitHub 加速代理)
|
|
134
|
+
// → 最后兜底是 PyPI 镜像上的 uv wheel(win32 才有,且只有 x64 的 wheel)
|
|
135
|
+
const sources = a.names.flatMap((name) => {
|
|
136
|
+
const asset = `https://github.com/astral-sh/uv/releases/latest/download/${name}`
|
|
137
|
+
return [
|
|
138
|
+
{ label: `GitHub 直连(${name})`, url: asset, file: join(tmp, name) },
|
|
139
|
+
{ label: `GitHub 加速代理 gh-proxy.com(${name})`, url: `https://gh-proxy.com/${asset}`, file: join(tmp, name) },
|
|
140
|
+
{ label: `GitHub 加速代理 ghproxy.net(${name})`, url: `https://ghproxy.net/${asset}`, file: join(tmp, name) },
|
|
141
|
+
]
|
|
142
|
+
})
|
|
143
|
+
if (process.platform === 'win32') {
|
|
144
|
+
try {
|
|
145
|
+
const r = await fetch('https://pypi.tuna.tsinghua.edu.cn/pypi/uv/json')
|
|
146
|
+
const j = await r.json()
|
|
147
|
+
// ⚠️ PyPI 的 urls 顺序**不保证最新在前** ⇒ 必须按版本号自己排序挑最新(踩过:取到了 0.2.33 的老版本 ✗)
|
|
148
|
+
const verOf = (name) => { const m = /-(\d+\.\d+\.\d+(?:[.-][0-9A-Za-z.]+)?)-py3-none-win_amd64\.whl$/.exec(String(name)); return m ? m[1] : '0.0.0' }
|
|
149
|
+
const cmpVer = (a, b) => {
|
|
150
|
+
const A = verOf(a).split(/[.-]/).map(Number), B = verOf(b).split(/[.-]/).map(Number)
|
|
151
|
+
for (let i = 0; i < 4; i++) { if ((A[i] || 0) !== (B[i] || 0)) return (B[i] || 0) - (A[i] || 0) }
|
|
152
|
+
return 0
|
|
153
|
+
}
|
|
154
|
+
const w = (j.urls || [])
|
|
155
|
+
.filter((u) => /win_amd64\.whl$/.test(String(u.filename)))
|
|
156
|
+
.sort((x, y) => cmpVer(x.filename, y.filename))[0]
|
|
157
|
+
if (w?.url) {
|
|
158
|
+
sources.push({ label: 'PyPI 清华镜像(uv wheel)', url: w.url, file: join(tmp, String(w.filename)), sha: w.digests?.sha256 })
|
|
159
|
+
log(` (备选源已就绪:${w.filename})`)
|
|
160
|
+
}
|
|
161
|
+
} catch (e) {
|
|
162
|
+
log(` 列 PyPI 版本时出错(不影响,继续试别的源):${e?.message ?? e}`)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
for (const s of sources) {
|
|
167
|
+
try {
|
|
168
|
+
// 每个候选都从干净的解压目录开始,别让上一个候选的残留文件被 findBin 误判
|
|
169
|
+
rmSync(tmp, { recursive: true, force: true })
|
|
170
|
+
mkdirSync(tmp, { recursive: true })
|
|
171
|
+
log(`正在下载 uv —— ${s.label}`)
|
|
172
|
+
const res = await fetch(s.url)
|
|
173
|
+
if (!res.ok) { log(` → 返回 ${res.status},换下一个源`); continue }
|
|
174
|
+
await pipeline(Readable.fromWeb(res.body), createWriteStream(s.file))
|
|
175
|
+
const mb = (statSync(s.file).size / 1048576).toFixed(1)
|
|
176
|
+
log(` → 下载完成 ${mb} MB`)
|
|
177
|
+
// ⭐ 完整性校验:下载下来是要**被执行**的,必须跟官方 sha256 对上(防的是第三方代理动过包 ✗)
|
|
178
|
+
const want = await expectedSha(s)
|
|
179
|
+
if (want) {
|
|
180
|
+
const gotSha = sha256Of(s.file)
|
|
181
|
+
if (gotSha !== want) {
|
|
182
|
+
log(` → ⚠️ sha256 校验不过(期望 ${want.slice(0, 12)}… 实际 ${gotSha.slice(0, 12)}…)⇒ 丢弃这个源`)
|
|
183
|
+
continue
|
|
184
|
+
}
|
|
185
|
+
log(' → 官方 sha256 校验通过 ✓')
|
|
186
|
+
} else {
|
|
187
|
+
log(' → 没取到官方 sha256,跳过校验(下载来自 HTTPS 的官方地址时风险很小)')
|
|
188
|
+
}
|
|
189
|
+
log(' → 开始解压')
|
|
190
|
+
const hit = extractArchive(a.bin, s.file, tmp)
|
|
191
|
+
if (!hit) { log(' → 解压后没找到可执行文件,换下一个源'); continue }
|
|
192
|
+
copyFileSync(hit, target)
|
|
193
|
+
try { chmodSync(target, 0o755) } catch { /* Windows 上不需要 */ }
|
|
194
|
+
// ⭐ 版本检查:这个二进制得能**在这台机器上跑**——架构/ABI 不匹配(比如把 x86 的包下到了 arm64)会跑不起来 ✗
|
|
195
|
+
let runs = false
|
|
196
|
+
try {
|
|
197
|
+
const r = spawnSync(target, ['--version'], { stdio: 'ignore' })
|
|
198
|
+
runs = r.status === 0
|
|
199
|
+
log(' → 版本检查:' + (runs ? '能跑 ✓' : '跑不起来 ✗'))
|
|
200
|
+
} catch { runs = false }
|
|
201
|
+
if (!runs) {
|
|
202
|
+
log(' → 架构/ABI 不匹配,换下一个候选')
|
|
203
|
+
try { rmSync(target, { force: true }) } catch { /* 删不掉也不拦着 */ }
|
|
204
|
+
continue
|
|
205
|
+
}
|
|
206
|
+
rmSync(tmp, { recursive: true, force: true })
|
|
207
|
+
log(` → uv 已就位:${target}`)
|
|
208
|
+
return target
|
|
209
|
+
} catch (e) {
|
|
210
|
+
log(` → ${s.label} 失败:${e?.message ?? e}`)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
rmSync(tmp, { recursive: true, force: true })
|
|
215
|
+
log('所有源都拿不到 uv(大概是网络到不了 GitHub / PyPI 镜像)')
|
|
216
|
+
return null
|
|
217
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/verify.mjs —— 「评论发出后复核」
|
|
3
|
+
* ============================================================================
|
|
4
|
+
* 为什么要有它(2026-10-16,用户 `你的deepseek` 在评论区反馈 + 我们 10/10 亲踩):
|
|
5
|
+
* **接口回「发送成功」≠ 公开可见** —— 新号 / 风控会让评论进审核,你自己看不见,
|
|
6
|
+
* 而插件以为发出去了、还把它记进判重表 ⇒ 下一轮不再发 ⇒ **一条都没到人**。
|
|
7
|
+
* 还有更坏的一层:**不公开时连通知都不会推**,于是"@ 了但没人收到"。
|
|
8
|
+
*
|
|
9
|
+
* 复核靠两条只读接口(2026-10-16 实测可行):
|
|
10
|
+
* ① **顶层评论**:`/x/v2/reply/main?type=1&oid=<aid>&mode=2&next=0&ps=20`(按时间)
|
|
11
|
+
* —— 刚发出来的通常在**第一页**;找得到 ⇒ 公开可见(还能顺便读到赞数)。
|
|
12
|
+
* ② **楼中楼**:`/x/v2/reply/reply?type=1&oid=<aid>&root=<root>&ps=20`
|
|
13
|
+
* —— 直接按 root 拉那一串,找我们的 rpid。
|
|
14
|
+
* ⚠️ **看不到 ≠ 没发出**(翻页 / 热度排序都会漏)⇒ 结论一律用"**没查到**"这种说法,
|
|
15
|
+
* 不写成"没发出去"(这是 2026-10-15 那条教训的同一把尺子)。
|
|
16
|
+
* ✗ `/x/v2/reply/detail` 走不通(回 `-400 请求错误`),别无谓地换它。
|
|
17
|
+
* ============================================================================
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
20
|
+
import { join } from 'node:path'
|
|
21
|
+
import { dayKey } from './state.mjs'
|
|
22
|
+
|
|
23
|
+
const UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0 Safari/537.36'
|
|
24
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
|
|
25
|
+
|
|
26
|
+
/** 从判重表里抠出「我们发过的评论」记录:容忍 markdown 表格 / 列表 / 随手写的行 */
|
|
27
|
+
export function parseSeen(text) {
|
|
28
|
+
const rows = []
|
|
29
|
+
for (const line of String(text).split(/\r?\n/)) {
|
|
30
|
+
const bv = /BV[0-9A-Za-z]{10}/.exec(line)
|
|
31
|
+
if (!bv) continue
|
|
32
|
+
const nums = [...line.matchAll(/\b(\d{9,})\b/g)].map((m) => Number(m[1]))
|
|
33
|
+
if (!nums.length) continue
|
|
34
|
+
// 约定:第一个长数字 = rpid;如果后面还有第二个,且明显是另一个 id,就当 root(楼中楼)
|
|
35
|
+
const rpid = nums[0]
|
|
36
|
+
const root = nums.length > 1 ? nums[1] : 0
|
|
37
|
+
rows.push({ bv: bv[0], rpid, root, line: line.trim().slice(0, 160) })
|
|
38
|
+
}
|
|
39
|
+
return rows
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function loadCredential(stateDir) {
|
|
43
|
+
const f = join(stateDir, 'bili_credential.json')
|
|
44
|
+
if (!existsSync(f)) return null
|
|
45
|
+
try {
|
|
46
|
+
const c = JSON.parse(readFileSync(f, 'utf8'))
|
|
47
|
+
if (!c?.sessdata) return null
|
|
48
|
+
return c
|
|
49
|
+
} catch { return null }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function headersFor(cred) {
|
|
53
|
+
return {
|
|
54
|
+
'User-Agent': UA,
|
|
55
|
+
Referer: 'https://www.bilibili.com/',
|
|
56
|
+
Cookie: `SESSDATA=${cred.sessdata}; bili_jct=${cred.bili_jct}; buvid3=${cred.buvid3}`,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function jget(url, headers) {
|
|
61
|
+
try {
|
|
62
|
+
const r = await fetch(url, { headers })
|
|
63
|
+
const t = await r.text()
|
|
64
|
+
try { return JSON.parse(t) } catch { return { code: -999, message: 'not json' } }
|
|
65
|
+
} catch (e) { return { code: -998, message: String(e?.message ?? e) } }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 复核一条:先试顶层(按时间第一页),再试楼中楼(如果记了 root)
|
|
70
|
+
* @returns {{rpid:number, bv:string, visible:boolean|null, likes?:number, how:string, note:string}}
|
|
71
|
+
*/
|
|
72
|
+
export async function verifyOne(record, { cred, aidCache = new Map(), headers }) {
|
|
73
|
+
const out = { rpid: record.rpid, bv: record.bv, visible: null, how: '', note: '' }
|
|
74
|
+
if (!aidCache.has(record.bv)) {
|
|
75
|
+
const v = await jget(`https://api.bilibili.com/x/web-interface/view?bvid=${record.bv}`, headers)
|
|
76
|
+
aidCache.set(record.bv, v?.code === 0 ? { aid: v.data.aid, mid: v.data.owner?.mid, title: v.data.title } : null)
|
|
77
|
+
await sleep(300)
|
|
78
|
+
}
|
|
79
|
+
const meta = aidCache.get(record.bv)
|
|
80
|
+
if (!meta) { out.how = '取视频信息失败'; out.note = '这条跳过(视频可能已删/不可见)'; return out }
|
|
81
|
+
const aid = meta.aid
|
|
82
|
+
|
|
83
|
+
// ① 顶层:按时间第一页(刚发的就在这儿)
|
|
84
|
+
if (!record.root) {
|
|
85
|
+
const d = await jget(`https://api.bilibili.com/x/v2/reply/main?type=1&oid=${aid}&mode=2&next=0&ps=20`, headers)
|
|
86
|
+
const list = d?.data?.replies || []
|
|
87
|
+
const hit = list.find((r) => r.rpid === record.rpid)
|
|
88
|
+
if (hit && hit.rpid === record.rpid) {
|
|
89
|
+
out.visible = true; out.likes = hit.like; out.how = '顶层·最新一页'
|
|
90
|
+
out.note = hit.invisible ? '(但接口标了 invisible)' : ''
|
|
91
|
+
return out
|
|
92
|
+
}
|
|
93
|
+
out.how = '顶层·最新一页'
|
|
94
|
+
out.note = '最新一页里没找到 —— 可能还在审核,也可能只是翻页看不到(**不等于没发出去**)'
|
|
95
|
+
return out
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ② 楼中楼:按 root 拉那一串
|
|
99
|
+
const d = await jget(`https://api.bilibili.com/x/v2/reply/reply?type=1&oid=${aid}&root=${record.root}&ps=20&pn=1`, headers)
|
|
100
|
+
const subs = d?.data?.replies || []
|
|
101
|
+
const hit = subs.find((r) => r.rpid === record.rpid)
|
|
102
|
+
if (hit) {
|
|
103
|
+
out.visible = true; out.likes = hit.like; out.how = `楼中楼·root=${record.root}`
|
|
104
|
+
out.note = hit.invisible ? '(但接口标了 invisible)' : ''
|
|
105
|
+
return out
|
|
106
|
+
}
|
|
107
|
+
out.how = `楼中楼·root=${record.root}`
|
|
108
|
+
out.note = subs.length
|
|
109
|
+
? `那一串里有 ${subs.length} 条,但没有我们这条 —— 可能还在审核(**不等于没发出去**)`
|
|
110
|
+
: '那一串暂时拉不到内容 —— 可能还在审核(**不等于没发出去**)'
|
|
111
|
+
return out
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 复核最近的一批(默认最多 6 条、只挑没复核过的)
|
|
116
|
+
* @returns {Promise<{checked:Array, skipped:number, text:string}>}
|
|
117
|
+
*/
|
|
118
|
+
export async function verifyRecent(stateDir, { max = 6, log = () => {} } = {}) {
|
|
119
|
+
const seenFile = join(stateDir, 'seen.md')
|
|
120
|
+
if (!existsSync(seenFile)) return { checked: [], skipped: 0, text: '⚠️ 判重表还没生成,没什么可复核的' }
|
|
121
|
+
const cred = loadCredential(stateDir)
|
|
122
|
+
if (!cred) return { checked: [], skipped: 0, text: '⚠️ 还没扫码登录,没法复核(复核要用你自己的登录态)' }
|
|
123
|
+
|
|
124
|
+
const rows = parseSeen(readFileSync(seenFile, 'utf8'))
|
|
125
|
+
if (!rows.length) return { checked: [], skipped: 0, text: '还没发过评论,暂时不用核(等你开了「自动评论并 @ 你」、并且真的发出去过一条之后,这里才有东西可核)' }
|
|
126
|
+
|
|
127
|
+
// 状态账本:已经确认真见过的,7 天内不重复查
|
|
128
|
+
const stateFile = join(stateDir, 'verify-state.json')
|
|
129
|
+
let state = {}
|
|
130
|
+
try { state = JSON.parse(readFileSync(stateFile, 'utf8')) } catch { /* 头一次跑 */ }
|
|
131
|
+
const now = Date.now()
|
|
132
|
+
const fresh = []
|
|
133
|
+
let skipped = 0
|
|
134
|
+
for (const r of rows.slice().reverse()) { // 从最新的往回看
|
|
135
|
+
const prev = state[String(r.rpid)]
|
|
136
|
+
if (prev?.visible === true && now - (prev.at || 0) < 7 * 864e5) { skipped++; continue }
|
|
137
|
+
fresh.push(r)
|
|
138
|
+
if (fresh.length >= max) break
|
|
139
|
+
}
|
|
140
|
+
if (!fresh.length) return { checked: [], skipped, text: `都复核过了(跳过的旧记录 ${skipped} 条)` }
|
|
141
|
+
|
|
142
|
+
const headers = headersFor(cred)
|
|
143
|
+
const aidCache = new Map()
|
|
144
|
+
const checked = []
|
|
145
|
+
for (const r of fresh) {
|
|
146
|
+
const res = await verifyOne(r, { cred, aidCache, headers })
|
|
147
|
+
checked.push(res)
|
|
148
|
+
state[String(r.rpid)] = { visible: res.visible, at: now, how: res.how, bv: r.bv, likes: res.likes ?? null }
|
|
149
|
+
log(`复核 ${r.bv} rpid=${r.rpid} → ${res.visible === true ? '公开可见' : '没查到'}(${res.how})`)
|
|
150
|
+
await sleep(700)
|
|
151
|
+
}
|
|
152
|
+
try { writeFileSync(stateFile, JSON.stringify(state, null, 2), 'utf8') } catch { /* 写不了就算了,复核不该因此失败 */ }
|
|
153
|
+
|
|
154
|
+
const lines = ['', '## 评论复核(宿主自动跑的,不是那一轮自己说的)', '']
|
|
155
|
+
for (const c of checked) {
|
|
156
|
+
const t = c.visible === true ? `公开可见(赞 ${c.likes ?? 0})` : '没查到'
|
|
157
|
+
lines.push(`- \`${c.bv}\` rpid **${c.rpid}** —— ${t} · 依据:${c.how}${c.note ? ' · ' + c.note : ''}`)
|
|
158
|
+
}
|
|
159
|
+
if (skipped) lines.push(`- (另外 ${skipped} 条最近已复核过,没重复查)`)
|
|
160
|
+
const text = lines.join('\n')
|
|
161
|
+
return { checked, skipped, text }
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** 把复核结果追加到当天的报告末尾(报告可能还不存在 —— 那就别硬造一份) */
|
|
165
|
+
export function appendVerifyToReport(stateDir, text) {
|
|
166
|
+
try {
|
|
167
|
+
const f = join(stateDir, 'out', `${dayKey()}.md`)
|
|
168
|
+
if (!existsSync(f)) return null
|
|
169
|
+
// ⭐ #135:一轮里复核可能被触发两次(收尾自动核 + 手动点),原来是无脑追加 ⇒ 那段出现两遍
|
|
170
|
+
let cur = readFileSync(f, 'utf8')
|
|
171
|
+
const marker = '## 评论复核'
|
|
172
|
+
const at = cur.indexOf(marker)
|
|
173
|
+
if (at >= 0) cur = cur.slice(0, at).replace(/\s*$/, '') + '\n'
|
|
174
|
+
writeFileSync(f, cur.replace(/\s*$/, '') + '\n' + text + '\n', 'utf8')
|
|
175
|
+
return f
|
|
176
|
+
} catch { return null }
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ── 单独跑:node lib/verify.mjs <stateDir>(方便手工验 / 也方便我测) ──
|
|
180
|
+
if (process.argv[1] && /verify\.mjs$/.test(process.argv[1])) {
|
|
181
|
+
const dir = process.argv[2] || join(process.env.DSH_HOME || join(process.env.USERPROFILE || '.', '.dsh'), 'bili-duty')
|
|
182
|
+
const r = await verifyRecent(dir, { log: (m) => console.log(' ' + m) })
|
|
183
|
+
console.log(r.text)
|
|
184
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-bili-scroll",
|
|
3
|
+
"version": "2.2.2-local.1",
|
|
4
|
+
"description": "DSH 插件:每天替你刷一轮 B站 —— 读字幕挑出值得的、写一份日报,值得的就 @ 你",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"deepseek-harness",
|
|
9
|
+
"bilibili",
|
|
10
|
+
"mcp",
|
|
11
|
+
"duty"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/c1overzz/dsh-bili-scroll.git"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/c1overzz/dsh-bili-scroll#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/c1overzz/dsh-bili-scroll/issues"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "index.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./index.js",
|
|
26
|
+
"./client": "./client.js",
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"profile-template",
|
|
31
|
+
"index.js",
|
|
32
|
+
"client.js",
|
|
33
|
+
"cordis.patch.yml",
|
|
34
|
+
"lib",
|
|
35
|
+
"prompts",
|
|
36
|
+
"vendor",
|
|
37
|
+
"README.md",
|
|
38
|
+
"AGENTS.md",
|
|
39
|
+
"selfcheck.mjs",
|
|
40
|
+
"LICENSE",
|
|
41
|
+
"NOTICE.md",
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"CONTRIBUTORS.md"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"dsh": ">=0.1.7-rc.1",
|
|
47
|
+
"node": ">=22"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"test": "node --test"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@deepseek-ai/dsh-tools": "*",
|
|
54
|
+
"@deepseek-ai/schemastery": "*"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@deepseek-ai/dsh-tools": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"@deepseek-ai/schemastery": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"dsh": {
|
|
68
|
+
"bundle": {
|
|
69
|
+
"patch": "./cordis.patch.yml"
|
|
70
|
+
},
|
|
71
|
+
"client": {
|
|
72
|
+
"platform": "web",
|
|
73
|
+
"inject": [
|
|
74
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public",
|
|
82
|
+
"registry": "https://registry.npmjs.org/"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# 「刷B站」值班轮专用 profile(2026-10-24 安全加固 · 对齐 issue #96 / PR #97 的思路)
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# 为什么单独建一个 profile:
|
|
5
|
+
# 值班轮是**无人值守**的一轮。原来它跑在 stock 的 headless profile 上,那个 profile
|
|
6
|
+
# 只关了 hmr / credentials / authorization / deepseek-account —— 工具一个没动。
|
|
7
|
+
# 于是那一轮除了 B站 MCP 的几个只读工具,还带着整台电脑:
|
|
8
|
+
# tool-fs(任意读写)、tool-pwsh(任意命令)、tool-fs-search(全局搜)、
|
|
9
|
+
# tool-web / web-fetch-http(抓任意 URL)、subagent / workflow(绕开限制)、skill(读文件)。
|
|
10
|
+
# ⚠️ DSH 的沙箱只限制「写」,**读是不受限的** ⇒ 它能读 ~/.dsh/sessions/**(全部会话记录)、
|
|
11
|
+
# 凭证、工作区;而 B站 MCP 进程跑在沙箱外,是现成的外发通道。
|
|
12
|
+
# ⇒ 修法不是"叮嘱它别读",而是**不给它文件系统**;写日报/判重表/归档改走固定路径的窄口 MCP。
|
|
13
|
+
#
|
|
14
|
+
# 下面这些 id 都是 `dsh --profile headless --dump-default-config` 里的真实条目(写错 id 会让
|
|
15
|
+
# profile 组不起来,所以不要凭印象加)。
|
|
16
|
+
# ============================================================================
|
|
17
|
+
|
|
18
|
+
# ── headless 默认关掉、值班轮需要补开的(模型要用账号额度)──────────────────
|
|
19
|
+
- id: credentials
|
|
20
|
+
disabled: false
|
|
21
|
+
- id: authorization
|
|
22
|
+
disabled: false
|
|
23
|
+
- id: deepseek-account
|
|
24
|
+
disabled: false
|
|
25
|
+
- id: agent-default-model
|
|
26
|
+
config:
|
|
27
|
+
provider: deepseek-account
|
|
28
|
+
model: deepseek-flash
|
|
29
|
+
|
|
30
|
+
# ── 命令执行 ────────────────────────────────────────────────────────────────
|
|
31
|
+
- id: tool-bash
|
|
32
|
+
disabled: true
|
|
33
|
+
- id: tool-pwsh
|
|
34
|
+
disabled: true
|
|
35
|
+
- id: tool-jobs
|
|
36
|
+
disabled: true
|
|
37
|
+
- id: jobs
|
|
38
|
+
disabled: true
|
|
39
|
+
- id: tool-ralph
|
|
40
|
+
disabled: true
|
|
41
|
+
|
|
42
|
+
# ── 文件系统:读 / 写 / 搜 —— 一个都不留 ────────────────────────────────────
|
|
43
|
+
- id: tool-fs
|
|
44
|
+
disabled: true
|
|
45
|
+
- id: tool-fs-search
|
|
46
|
+
disabled: true
|
|
47
|
+
|
|
48
|
+
# ── 联网:B站 数据走 MCP,不需要它自己抓网页 ────────────────────────────────
|
|
49
|
+
- id: tool-web
|
|
50
|
+
disabled: true
|
|
51
|
+
- id: web-fetch-http
|
|
52
|
+
disabled: true
|
|
53
|
+
- id: web-search-deepseek
|
|
54
|
+
disabled: true
|
|
55
|
+
|
|
56
|
+
# ── 子代理 / 工作流:都能绕开工具限制 ───────────────────────────────────────
|
|
57
|
+
- id: tool-subagent
|
|
58
|
+
disabled: true
|
|
59
|
+
- id: tool-subagent-fork
|
|
60
|
+
disabled: true
|
|
61
|
+
- id: tool-subagent-control
|
|
62
|
+
disabled: true
|
|
63
|
+
- id: tool-subagent-list-agents
|
|
64
|
+
disabled: true
|
|
65
|
+
- id: subagent
|
|
66
|
+
disabled: true
|
|
67
|
+
- id: subagent-fork-in-process
|
|
68
|
+
disabled: true
|
|
69
|
+
- id: subagent-spawn-in-process
|
|
70
|
+
disabled: true
|
|
71
|
+
- id: workflow-ptc
|
|
72
|
+
disabled: true
|
|
73
|
+
- id: ptc-runtime
|
|
74
|
+
disabled: true
|
|
75
|
+
- id: tool-workflow
|
|
76
|
+
disabled: true
|
|
77
|
+
|
|
78
|
+
# ── 技能:会读文件 ──────────────────────────────────────────────────────────
|
|
79
|
+
- id: skill
|
|
80
|
+
disabled: true
|
|
81
|
+
- id: skill-filesystem
|
|
82
|
+
disabled: true
|
|
83
|
+
- id: skill-badge
|
|
84
|
+
disabled: true
|
|
85
|
+
- id: tool-skill
|
|
86
|
+
disabled: true
|
|
87
|
+
|
|
88
|
+
# ── 自动读 AGENTS.md(会把上级目录的私人设定塞进上下文)──────────────────────
|
|
89
|
+
- id: agent-instructions
|
|
90
|
+
disabled: true
|
|
91
|
+
|
|
92
|
+
# ── 装插件 / 热重载 / 改配置 ────────────────────────────────────────────────
|
|
93
|
+
- id: tool-plugin-manager
|
|
94
|
+
disabled: true
|
|
95
|
+
- id: plugin-manager
|
|
96
|
+
disabled: true
|
|
97
|
+
- id: hmr
|
|
98
|
+
disabled: true
|
|
99
|
+
|
|
100
|
+
# ── 目标循环 / 计划模式 / 待办 ──────────────────────────────────────────────
|
|
101
|
+
- id: goal
|
|
102
|
+
disabled: true
|
|
103
|
+
- id: command-goal
|
|
104
|
+
disabled: true
|
|
105
|
+
- id: tool-goal
|
|
106
|
+
disabled: true
|
|
107
|
+
- id: goal-round-driver
|
|
108
|
+
disabled: true
|
|
109
|
+
- id: plan-mode
|
|
110
|
+
disabled: true
|
|
111
|
+
- id: tool-todo
|
|
112
|
+
disabled: true
|
|
113
|
+
|
|
114
|
+
# ── MCP 资源读取 ────────────────────────────────────────────────────────────
|
|
115
|
+
- id: mcp-resources
|
|
116
|
+
disabled: true
|