dsh-chat-comprehension 0.2.0 → 0.3.1
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 +41 -9
- package/lib/engines.mjs +136 -0
- package/lib/index.js +54 -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 +3293 -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,195 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* storyboard — CLI 薄壳,真正的逻辑全在 src/pipeline.js(与 DSH 工具同一份实现)。
|
|
4
|
+
*
|
|
5
|
+
* node bin/storyboard.mjs <video> [--cells 9] [--sheets 1] [--from 0] [--to 300]
|
|
6
|
+
* [--pick sharp|mid|thumb] [--burn index|none]
|
|
7
|
+
* [--threshold auto|15] [--min-gap 1.2]
|
|
8
|
+
* [--transcript auto|off] [--no-adaptive] [--badge 0.15]
|
|
9
|
+
* [--out sheet.png] [--manifest m.json] [--plan 300] [--text]
|
|
10
|
+
*/
|
|
11
|
+
import { writeFile } from 'node:fs/promises';
|
|
12
|
+
|
|
13
|
+
import { args as parse } from './_args.mjs';
|
|
14
|
+
import { probeVideo } from '../src/storyboard/probe.js';
|
|
15
|
+
import { planWindows } from '../src/storyboard/plan.js';
|
|
16
|
+
import { isHttpUrl } from '../src/storyboard/url.js';
|
|
17
|
+
import { resolveInput } from '../src/storyboard/fetch.js';
|
|
18
|
+
import {
|
|
19
|
+
DETAIL_CHARS, formatManifest, formatTimeline, runStoryboard, saveStoryboards,
|
|
20
|
+
} from '../src/storyboard/pipeline.js';
|
|
21
|
+
|
|
22
|
+
const opt = parse(process.argv.slice(2), {
|
|
23
|
+
cells: 0, sheets: 0, from: 0, to: 0, threshold: 'auto', 'min-gap': 1.2,
|
|
24
|
+
pick: 'sharp', burn: 'index', badge: 0.15, transcript: 'auto',
|
|
25
|
+
out: 'storyboard.png', manifest: null, plan: 0, 'text-only': false, 'cell-range': null,
|
|
26
|
+
batch: 0, detail: 'med',
|
|
27
|
+
cookies: null, 'allow-anonymous': false, 'scan-height': 360, 'zoom-height': 1080,
|
|
28
|
+
'transcript-file': null, 'source-hash': false,
|
|
29
|
+
});
|
|
30
|
+
const input = opt._[0];
|
|
31
|
+
if (!input) {
|
|
32
|
+
console.error('usage: node bin/storyboard.mjs <video-or-url> [--cells 9] [--from 0] [--to 300] ...');
|
|
33
|
+
process.exit(2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 链接:先换成本地文件(本地路径原样返回)。下载一次低清,后面都是本地操作。
|
|
37
|
+
const fetchOptions = {
|
|
38
|
+
cookies: opt.cookies ?? undefined,
|
|
39
|
+
allowAnonymous: opt['allow-anonymous'] === true,
|
|
40
|
+
scanHeight: Number(opt['scan-height']) || 360,
|
|
41
|
+
zoomHeight: Number(opt['zoom-height']) || 1080,
|
|
42
|
+
};
|
|
43
|
+
let localPath = input;
|
|
44
|
+
let sourceInfo = null;
|
|
45
|
+
if (isHttpUrl(input)) {
|
|
46
|
+
try {
|
|
47
|
+
const resolved = await resolveInput(input, fetchOptions);
|
|
48
|
+
localPath = resolved.path;
|
|
49
|
+
sourceInfo = resolved.source;
|
|
50
|
+
console.error(`[fetch] ${sourceInfo.cached ? 'cached' : 'downloaded'} ${(sourceInfo.bytes / 1048576).toFixed(1)}MB ` +
|
|
51
|
+
`→ ${sourceInfo.scanActual ?? '?'}p (source max ${sourceInfo.maxAvailable ?? '?'}p, auth=${sourceInfo.auth})`);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(`取流失败:${error.message}`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const info = await probeVideo(localPath).catch((error) => {
|
|
59
|
+
console.error(`探测失败:${error.message}`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// --plan:只算分段,不渲染
|
|
64
|
+
if (Number(opt.plan) > 0) {
|
|
65
|
+
const p = planWindows(info.duration, Number(opt.plan));
|
|
66
|
+
console.log(`[plan] ${info.duration.toFixed(0)}s → ${p.total} 段(每段 ≈${p.step.toFixed(0)}s),` +
|
|
67
|
+
`预计 ${p.total} 张图 ≈ ${p.approxTokens} token` +
|
|
68
|
+
`${p.stepAdjusted ? ` ⚠️ 段数超上限,已把每段从 ${p.requestedStep}s 拉长以保证覆盖全片` : ''}`);
|
|
69
|
+
for (const w of p.windows) {
|
|
70
|
+
console.log(` ${String(w.index).padStart(2)}. ${w.from.toFixed(0).padStart(5)}–${w.to.toFixed(0).padStart(5)}s ` +
|
|
71
|
+
`(${w.duration.toFixed(0)}s) ${w.cells} 格 ×${w.images} ≈${w.approxTokens} tok`);
|
|
72
|
+
}
|
|
73
|
+
console.log('\n逐段跑:node bin/storyboard.mjs <video> --from A --to B');
|
|
74
|
+
process.exit(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// --batch <秒>:把整片按固定步长切成若干窗口,逐个出图,最后写一张时间线表。
|
|
78
|
+
// 一部 2 小时半的电影手工敲 24 次 --from/--to 不现实,这是给长片用的入口。
|
|
79
|
+
const batchStep = Number(opt.batch) || 0;
|
|
80
|
+
if (batchStep > 0) {
|
|
81
|
+
// 先全片扫一遍拿切点,让窗口边界落在剪辑点上(而不是钟表上)。
|
|
82
|
+
// 2 小时片约 25s,相对于几十个窗口的渲染时间可以忽略。
|
|
83
|
+
let boundaries = [];
|
|
84
|
+
let precomputed = null;
|
|
85
|
+
if (opt.snap !== false) {
|
|
86
|
+
const { scanShots } = await import('../src/storyboard/scan.js');
|
|
87
|
+
console.log('[batch] 全片扫描切点(用于窗口对齐,可加 --no-snap 跳过)…');
|
|
88
|
+
// 这一遍的切点也直接喂给每个窗口,省掉"每个窗口各扫一遍"的重复解码
|
|
89
|
+
precomputed = await scanShots({ input: localPath, fps: info.fps, threshold: 'auto' });
|
|
90
|
+
boundaries = precomputed.cuts.map((c) => c.t);
|
|
91
|
+
console.log(`[batch] 切点 ${boundaries.length} 个(窗口内复用,不再重复扫描)`);
|
|
92
|
+
}
|
|
93
|
+
const planW = planWindows(info.duration, batchStep, { boundaries });
|
|
94
|
+
if (planW.snapped) console.log(`[batch] ${planW.snapped} 个窗口边界吸附到剪辑点`);
|
|
95
|
+
const base = String(opt.out).replace(/\.png$/i, '');
|
|
96
|
+
const rows = [];
|
|
97
|
+
const t0 = Date.now();
|
|
98
|
+
for (const w of planW.windows) {
|
|
99
|
+
const r = await runStoryboard({
|
|
100
|
+
input: localPath, from: w.from, to: w.to, cells: 0, sheets: 0,
|
|
101
|
+
threshold: opt.threshold === 'auto' ? 'auto' : Number(opt.threshold),
|
|
102
|
+
pick: String(opt.pick), burn: String(opt.burn), transcript: String(opt.transcript),
|
|
103
|
+
precomputed,
|
|
104
|
+
});
|
|
105
|
+
const image = `${base}-w${String(w.index).padStart(2, '0')}.png`;
|
|
106
|
+
await saveStoryboards(r, image, { quality: 4 });
|
|
107
|
+
const cells = r.sheets.flatMap((sh) => sh.cells);
|
|
108
|
+
rows.push({
|
|
109
|
+
index: w.index, from: w.from, to: w.to,
|
|
110
|
+
cells: cells.length, cuts: r.cuts.length,
|
|
111
|
+
chars: r.transcript?.chars ?? 0, image,
|
|
112
|
+
});
|
|
113
|
+
console.log(`[batch] ${w.index}/${planW.total} ${w.from.toFixed(0)}–${w.to.toFixed(0)}s ` +
|
|
114
|
+
`${cells.length} 格 → ${image} (${Date.now() - t0}ms)`);
|
|
115
|
+
}
|
|
116
|
+
const md = formatTimeline(rows, { title: `${info.path ?? input} — ${planW.total} windows @ ${batchStep}s` });
|
|
117
|
+
const mdPath = `${base}-timeline.md`;
|
|
118
|
+
await writeFile(mdPath, `${md}\n`, 'utf8');
|
|
119
|
+
console.log(`\n${md}`);
|
|
120
|
+
console.log(`[batch] 汇总写入 ${mdPath} 总耗时 ${((Date.now() - t0) / 1000).toFixed(1)}s`);
|
|
121
|
+
process.exit(0);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const adaptive = !process.argv.includes('--no-adaptive');
|
|
125
|
+
const textOnly = Boolean(opt['text-only']);
|
|
126
|
+
const cellRange = (() => {
|
|
127
|
+
const raw = opt['cell-range'];
|
|
128
|
+
if (!raw) return null;
|
|
129
|
+
const m = String(raw).match(/^(\d+)-(\d+)$/);
|
|
130
|
+
return m ? [Number(m[1]), Number(m[2])] : null;
|
|
131
|
+
})();
|
|
132
|
+
const t0 = Date.now();
|
|
133
|
+
const r = await runStoryboard({
|
|
134
|
+
input,
|
|
135
|
+
fetchOptions,
|
|
136
|
+
transcriptFile: opt['transcript-file'] ?? undefined,
|
|
137
|
+
sourceHash: opt['source-hash'] === true,
|
|
138
|
+
from: Number(opt.from) || 0,
|
|
139
|
+
to: Number(opt.to) || 0,
|
|
140
|
+
cells: Number(opt.cells) || 0,
|
|
141
|
+
sheets: Number(opt.sheets) || 0,
|
|
142
|
+
threshold: opt.threshold === 'auto' ? 'auto' : Number(opt.threshold),
|
|
143
|
+
minGap: Number(opt['min-gap']) || 0,
|
|
144
|
+
pick: String(opt.pick),
|
|
145
|
+
burn: String(opt.burn),
|
|
146
|
+
// `--badge 0` 必须真的等于 0:`Number(0) || 0.15` 会把它变成 0.15,
|
|
147
|
+
// 于是"关掉烧字"变成了"用默认大小烧"。
|
|
148
|
+
badgeRatio: opt.badge === undefined ? 0.15 : Number(opt.badge),
|
|
149
|
+
transcript: String(opt.transcript),
|
|
150
|
+
adaptive,
|
|
151
|
+
textOnly,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
console.log(`[probe] ${info.width}x${info.height} ${info.fps.toFixed(2)}fps ${info.duration.toFixed(2)}s` +
|
|
155
|
+
`${info.hasAudio ? ' audio' : ''}${info.hasSubtitle ? ' subtitle' : ''}` +
|
|
156
|
+
(r.window.from > 0 || r.window.to < info.duration
|
|
157
|
+
? ` window=${r.window.from.toFixed(1)}..${r.window.to.toFixed(1)}s` : ''));
|
|
158
|
+
console.log(`[scan] ${r.summary.frames} 帧 → ${r.cuts.length} 个切点(阈值 ${r.threshold},` +
|
|
159
|
+
`${r.plan.adaptive ? `自适应 ${r.plan.bursts.length} 个密集段` : '均匀分配'})`);
|
|
160
|
+
console.log(`[plan] ${r.plan.cells} 格 × ${r.plan.sheets} 张 — ${r.plan.reason}`);
|
|
161
|
+
if (r.audio) console.log(`[audio] ${r.audio.summary}`);
|
|
162
|
+
if (r.transcript) {
|
|
163
|
+
console.log(`[transcript] ${r.transcript.source}${r.transcript.model ? ` (${r.transcript.model})` : ''}` +
|
|
164
|
+
`${r.transcript.segments ? `,${r.transcript.segments} 段` : ''}` +
|
|
165
|
+
`${r.transcript.error ? ` ⚠️ ${r.transcript.error}` : ''}`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const paths = await saveStoryboards(r, opt.out, { quality: 4 });
|
|
169
|
+
for (const [i, sheet] of r.sheets.entries()) {
|
|
170
|
+
console.log(`[sheet] ${paths[i]} ${sheet.width}x${sheet.height} ${sheet.cols}x${sheet.rows}` +
|
|
171
|
+
` cell≈${sheet.cellW}x${sheet.cellH}${sheet.stripH ? ` strip=${sheet.stripH}px` : ''}`);
|
|
172
|
+
}
|
|
173
|
+
console.log(`[done] ${Date.now() - t0}ms`);
|
|
174
|
+
|
|
175
|
+
if (opt.manifest) {
|
|
176
|
+
const payload = {
|
|
177
|
+
input, window: r.window, threshold: r.threshold, summary: r.summary,
|
|
178
|
+
provenance: r.provenance,
|
|
179
|
+
audio: r.audio ? { mean: r.audio.mean, peak: r.audio.peak, silences: r.audio.silences } : null,
|
|
180
|
+
transcript: r.transcript,
|
|
181
|
+
plan: r.plan,
|
|
182
|
+
sheets: r.sheets.map((s) => ({
|
|
183
|
+
sheet: s.sheet, cols: s.cols, rows: s.rows, width: s.width, height: s.height,
|
|
184
|
+
stripH: s.stripH ?? null, cells: s.cells,
|
|
185
|
+
})),
|
|
186
|
+
};
|
|
187
|
+
await writeFile(opt.manifest, `${JSON.stringify(payload, null, 2)}\n`, 'utf8');
|
|
188
|
+
console.log(`[manifest] ${opt.manifest}`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (opt.text) {
|
|
192
|
+
console.log(`\n${formatManifest(r, {
|
|
193
|
+
cellRange, maxCellChars: DETAIL_CHARS[String(opt.detail)] ?? DETAIL_CHARS.med,
|
|
194
|
+
})}`);
|
|
195
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-video-storyboard",
|
|
3
|
+
"description": "Scene-aware storyboard tool for DeepSeek Harness: one addressable grid per video, with an index the model can cite.",
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"entry": {
|
|
6
|
+
"name": "dsh-video-storyboard",
|
|
7
|
+
"inject": [
|
|
8
|
+
"tools",
|
|
9
|
+
"attachments"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-video-storyboard",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Scene-aware storyboard for DeepSeek Harness: one addressable grid per video (numbered cells, timestamps, transcript, audio envelope) so a text-only agent can look at the video itself instead of being told a summary.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"deepseek-harness",
|
|
9
|
+
"video",
|
|
10
|
+
"storyboard",
|
|
11
|
+
"contact-sheet",
|
|
12
|
+
"ffmpeg",
|
|
13
|
+
"multimodal",
|
|
14
|
+
"asr"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/SAOS-3624/dsh-video-storyboard#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/SAOS-3624/dsh-video-storyboard/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/SAOS-3624/dsh-video-storyboard.git"
|
|
23
|
+
},
|
|
24
|
+
"author": "SAOS-3624",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./src/index.js",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": "./src/index.js",
|
|
30
|
+
"./plan": "./src/storyboard/plan.js",
|
|
31
|
+
"./scan": "./src/storyboard/scan.js",
|
|
32
|
+
"./segments": "./src/storyboard/segments.js",
|
|
33
|
+
"./probe": "./src/storyboard/probe.js",
|
|
34
|
+
"./sheet": "./src/storyboard/sheet.js",
|
|
35
|
+
"./frames": "./src/storyboard/frames.js",
|
|
36
|
+
"./format": "./src/storyboard/format.js",
|
|
37
|
+
"./pipeline": "./src/storyboard/pipeline.js",
|
|
38
|
+
"./tool-spec": "./src/tool-spec.js",
|
|
39
|
+
"./storyboard": "./src/storyboard/index.js",
|
|
40
|
+
"./board": "./src/storyboard/board.js",
|
|
41
|
+
"./cache": "./src/storyboard/cache.js",
|
|
42
|
+
"./storage": "./src/storyboard/storage.js",
|
|
43
|
+
"./locate": "./src/storyboard/locate.js",
|
|
44
|
+
"./subtitles": "./src/storyboard/subtitles.js",
|
|
45
|
+
"./ytdlp": "./src/storyboard/ytdlp.js",
|
|
46
|
+
"./python": "./src/storyboard/python.js",
|
|
47
|
+
"./browser-time": "./src/storyboard/browser-time.js"
|
|
48
|
+
},
|
|
49
|
+
"bin": {
|
|
50
|
+
"dsh-video-scan": "./bin/scan-video.mjs",
|
|
51
|
+
"dsh-video-storyboard": "./bin/storyboard.mjs"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"src",
|
|
55
|
+
"bin",
|
|
56
|
+
"scripts",
|
|
57
|
+
"docs",
|
|
58
|
+
"cordis.patch.yml",
|
|
59
|
+
"dsh.plugin.json",
|
|
60
|
+
"README.md",
|
|
61
|
+
"README.zh.md",
|
|
62
|
+
"CHANGELOG.md",
|
|
63
|
+
"LICENSE",
|
|
64
|
+
"CREDITS.md",
|
|
65
|
+
"NOTICE"
|
|
66
|
+
],
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=20"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"test": "node --test",
|
|
72
|
+
"prepublishOnly": "npm test",
|
|
73
|
+
"check": "node scripts/check-syntax.mjs"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@deepseek-ai/dsh-tools": ">=0.1.0-rc.7"
|
|
77
|
+
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"@deepseek-ai/dsh-tools": {
|
|
80
|
+
"optional": true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"dsh": {
|
|
84
|
+
"bundle": {
|
|
85
|
+
"patch": "./cordis.patch.yml"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// 跨平台语法检查:`node --check` 的批量版本。
|
|
2
|
+
//
|
|
3
|
+
// 为什么不用 bash 的 for 循环:Windows 上 npm 用 cmd.exe 跑 scripts,
|
|
4
|
+
// `for f in src/*.js; do ... done` 是 POSIX 语法,在那里会直接失败,
|
|
5
|
+
// 于是 `npm run check` 在 Windows 上等于不可用。
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
import { readdir } from 'node:fs/promises';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { promisify } from 'node:util';
|
|
10
|
+
|
|
11
|
+
const run = promisify(execFile);
|
|
12
|
+
|
|
13
|
+
const DIRS = ['src', 'bin', 'scripts', 'examples'];
|
|
14
|
+
const EXT = /\.(mjs|js)$/;
|
|
15
|
+
|
|
16
|
+
// **必须递归**:src/tools/ 这种子目录里的文件不扫,等于给自己留了个"语法错了但 check 通过"的洞。
|
|
17
|
+
async function walk(dir) {
|
|
18
|
+
let entries = [];
|
|
19
|
+
try {
|
|
20
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
21
|
+
} catch {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const e of entries) {
|
|
26
|
+
const p = join(dir, e.name);
|
|
27
|
+
if (e.isDirectory()) out.push(...await walk(p));
|
|
28
|
+
else if (e.isFile() && EXT.test(e.name)) out.push(p);
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const files = [];
|
|
34
|
+
for (const dir of DIRS) files.push(...await walk(dir));
|
|
35
|
+
|
|
36
|
+
if (files.length === 0) {
|
|
37
|
+
console.error('check: no source files found (run from the repo root)');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const failures = [];
|
|
42
|
+
for (const file of files.sort()) {
|
|
43
|
+
try {
|
|
44
|
+
await run(process.execPath, ['--check', file]);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
failures.push({ file, message: (err.stderr || err.message || '').trim() });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (failures.length > 0) {
|
|
51
|
+
for (const f of failures) console.error(`✗ ${f.file}\n${f.message}\n`);
|
|
52
|
+
console.error(`check: ${failures.length} of ${files.length} file(s) failed`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log(`check: ${files.length} file(s) ok`);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* install-dev — 把本包同步进 DSH 的 desktop profile(开发用),并注册为 bundle。
|
|
4
|
+
*
|
|
5
|
+
* node scripts/install-dev.mjs # 安装 / 同步
|
|
6
|
+
* node scripts/install-dev.mjs --remove # 卸载(还原 package.json)
|
|
7
|
+
* node scripts/install-dev.mjs --check # 只检查当前状态,不改动
|
|
8
|
+
*
|
|
9
|
+
* 为什么要手动做这件事:desktop profile 由 Electron 应用独占管理,
|
|
10
|
+
* `dsh plugin --profile desktop ...` 会被拒绝("managed exclusively by the Electron application")。
|
|
11
|
+
*
|
|
12
|
+
* 为什么是复制而不是软链:Node 解析裸包名(`@deepseek-ai/dsh-tools`)时用的是真实路径,
|
|
13
|
+
* 软链会让它从源码目录向上找、找不到宿主的包。复制到 profile 的 node_modules 里,
|
|
14
|
+
* 解析链才是 profiles/desktop/node_modules → profiles/node_modules。
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { cp, readFile, writeFile, rm, readdir, stat } from 'node:fs/promises';
|
|
18
|
+
import { existsSync } from 'node:fs';
|
|
19
|
+
import { dirname, join, resolve } from 'node:path';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import { homedir } from 'node:os';
|
|
22
|
+
|
|
23
|
+
const HERE = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
24
|
+
const DSH_HOME = process.env.DSH_HOME || join(homedir(), '.dsh');
|
|
25
|
+
const PROFILE = process.env.DSH_PROFILE || 'desktop';
|
|
26
|
+
const PROFILE_DIR = join(DSH_HOME, 'profiles', PROFILE);
|
|
27
|
+
const TARGET = join(PROFILE_DIR, 'node_modules', 'dsh-video-storyboard');
|
|
28
|
+
const PKG_NAME = 'dsh-video-storyboard';
|
|
29
|
+
// `.tmp` 必须跳过:里面有调试输出、Edge 的一次性 profile(Cookies 文件被占用时 cp 会直接失败)
|
|
30
|
+
const SKIP = new Set(['node_modules', '.git', 'test', '.tmp']);
|
|
31
|
+
|
|
32
|
+
const mode = process.argv.includes('--remove') ? 'remove'
|
|
33
|
+
: process.argv.includes('--check') ? 'check' : 'install';
|
|
34
|
+
|
|
35
|
+
if (!existsSync(PROFILE_DIR)) {
|
|
36
|
+
console.error(`profile 不存在:${PROFILE_DIR}`);
|
|
37
|
+
process.exit(2);
|
|
38
|
+
}
|
|
39
|
+
const pkgPath = join(PROFILE_DIR, 'package.json');
|
|
40
|
+
const backupGlob = `package.json.bak-`; // 首次安装会留一份
|
|
41
|
+
|
|
42
|
+
async function readJson(path) {
|
|
43
|
+
return JSON.parse(await readFile(path, 'utf8'));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function patchProfile({ add }) {
|
|
47
|
+
const pkg = await readJson(pkgPath);
|
|
48
|
+
const bundles = pkg.dsh?.profile?.bundles ?? [];
|
|
49
|
+
const hasDep = Object.hasOwn(pkg.dependencies ?? {}, PKG_NAME);
|
|
50
|
+
|
|
51
|
+
if (add) {
|
|
52
|
+
if (!hasDep) {
|
|
53
|
+
const backup = join(PROFILE_DIR, `${backupGlob}${new Date().toISOString().replace(/[:.]/g, '-')}-preinstall`);
|
|
54
|
+
await writeFile(backup, await readFile(pkgPath), 'utf8');
|
|
55
|
+
console.log(`已备份 package.json → ${backup}`);
|
|
56
|
+
}
|
|
57
|
+
pkg.dependencies = { ...(pkg.dependencies ?? {}), [PKG_NAME]: `file:${HERE.replace(/\\/g, '/')}` };
|
|
58
|
+
if (!bundles.includes(PKG_NAME)) pkg.dsh.profile.bundles = [...bundles, PKG_NAME];
|
|
59
|
+
} else {
|
|
60
|
+
if (pkg.dependencies) delete pkg.dependencies[PKG_NAME];
|
|
61
|
+
if (pkg.dsh?.profile?.bundles) {
|
|
62
|
+
pkg.dsh.profile.bundles = pkg.dsh.profile.bundles.filter((b) => b !== PKG_NAME);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
await writeFile(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, 'utf8');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function syncFiles() {
|
|
69
|
+
await rm(TARGET, { recursive: true, force: true });
|
|
70
|
+
await cp(HERE, TARGET, {
|
|
71
|
+
recursive: true,
|
|
72
|
+
filter: (src) => !SKIP.has(src.split(/[\\/]/).pop()),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function report() {
|
|
77
|
+
const installed = existsSync(TARGET);
|
|
78
|
+
const pkg = await readJson(pkgPath);
|
|
79
|
+
const registered = (pkg.dsh?.profile?.bundles ?? []).includes(PKG_NAME);
|
|
80
|
+
const dep = pkg.dependencies?.[PKG_NAME] ?? null;
|
|
81
|
+
console.log(`profile : ${PROFILE_DIR}`);
|
|
82
|
+
console.log(`node_modules : ${installed ? '已安装' : '未安装'} ${TARGET}`);
|
|
83
|
+
console.log(`bundles 注册 : ${registered ? '是' : '否'}`);
|
|
84
|
+
console.log(`dependencies : ${dep ?? '无'}`);
|
|
85
|
+
return { installed, registered, dep };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (mode === 'check') {
|
|
89
|
+
await report();
|
|
90
|
+
process.exit(0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (mode === 'remove') {
|
|
94
|
+
await rm(TARGET, { recursive: true, force: true });
|
|
95
|
+
await patchProfile({ add: false });
|
|
96
|
+
console.log('已卸载。重启 DSH 生效(tool 会消失)。');
|
|
97
|
+
await report();
|
|
98
|
+
process.exit(0);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await syncFiles();
|
|
102
|
+
await patchProfile({ add: true });
|
|
103
|
+
await report();
|
|
104
|
+
console.log('\n完成。重启 DSH Desktop 后生效(插件树在进程启动时组合)。');
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* flicker.js — 识别"只有局部在闪、底图不动"的蒙版 / 故障效果,并顺手给出堆叠后的画面。
|
|
3
|
+
*
|
|
4
|
+
* 为什么需要:MAD / 赛博故障类的素材里,经常是**底下的画面稳定,只有叠加的蒙版在闪**
|
|
5
|
+
* (屏幕上的小字、网格、扫描线)。这种片段在逐帧分数上和"快速剪辑"长得一模一样 ——
|
|
6
|
+
* 每帧都在变、分数都高 —— 但两者该被完全相反地处理:
|
|
7
|
+
*
|
|
8
|
+
* 快速剪辑 → 每一帧都是新内容,要摊成子格
|
|
9
|
+
* 闪烁蒙版 → 闪的不是内容,摊开等于把噪声放大 9 倍;应该**堆叠成一张**把闪烁平均掉
|
|
10
|
+
*
|
|
11
|
+
* 判据不看时间上的周期性(闪烁可以是 ABAB、也可以是 ABCDEFGABCDEFG,甚至无规律),
|
|
12
|
+
* 只看**空间上有没有一块从来没动过的底**:
|
|
13
|
+
*
|
|
14
|
+
* coreRatio 所有帧都贴着时间中位数的像素比例 —— 有底就高,剪辑就低
|
|
15
|
+
* flickerRatio 在容差内外来回翻转 ≥ minFlips 次的像素比例 —— 闪烁高,走过的人低
|
|
16
|
+
*
|
|
17
|
+
* 剪辑的每一个镜头只占 1/k 的时间,中位数只等于其中一帧,其它镜头大片偏离 → coreRatio 低。
|
|
18
|
+
* 所以这一个量就能把两者分开,且与周期无关。
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 逐像素时间统计 + 中位数堆叠。
|
|
23
|
+
*
|
|
24
|
+
* @param {Buffer[]} frames 同尺寸的 rgb24 帧
|
|
25
|
+
* @param {{tolerance?:number, minFlips?:number}} opts
|
|
26
|
+
* tolerance: 通道差超过它算"偏离底图"(0–255)
|
|
27
|
+
* minFlips: 来回跨越几次算"在闪"
|
|
28
|
+
* @returns {{median:Buffer, coreRatio:number, flickerRatio:number, pixels:number}}
|
|
29
|
+
*/
|
|
30
|
+
export function analyseStack(frames, { tolerance = 18, minFlips = 3 } = {}) {
|
|
31
|
+
if (!Array.isArray(frames) || frames.length < 3) {
|
|
32
|
+
throw new RangeError('analyseStack needs at least 3 frames');
|
|
33
|
+
}
|
|
34
|
+
const n = frames.length;
|
|
35
|
+
const len = frames[0].length;
|
|
36
|
+
if (frames.some((f) => f.length !== len)) {
|
|
37
|
+
throw new RangeError('all frames must have the same length');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const median = Buffer.alloc(len);
|
|
41
|
+
let core = 0;
|
|
42
|
+
let flicker = 0;
|
|
43
|
+
|
|
44
|
+
const vals = new Array(n);
|
|
45
|
+
for (let i = 0; i < len; i++) {
|
|
46
|
+
for (let c = 0; c < n; c++) vals[c] = frames[c][i];
|
|
47
|
+
vals.sort((a, b) => a - b);
|
|
48
|
+
// 偶数个用中间两个的均值:比直接取低中位更不容易偏向某一帧
|
|
49
|
+
const m = n % 2 === 1 ? vals[(n - 1) / 2] : Math.round((vals[n / 2 - 1] + vals[n / 2]) / 2);
|
|
50
|
+
median[i] = m;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 逐像素判"是否一直贴着中位数"(core)与"是否来回翻"(flicker)。
|
|
54
|
+
// 按像素(三通道一起)判,而不是按通道:单通道抖动不足以说明"这块在闪"。
|
|
55
|
+
const px = len / 3;
|
|
56
|
+
for (let p = 0; p < px; p++) {
|
|
57
|
+
const base = p * 3;
|
|
58
|
+
let near = true; // 每一帧都在容差内
|
|
59
|
+
let flips = 0;
|
|
60
|
+
let prevFar = null;
|
|
61
|
+
for (let c = 0; c < n; c++) {
|
|
62
|
+
const f = frames[c];
|
|
63
|
+
const d = Math.max(
|
|
64
|
+
Math.abs(f[base] - median[base]),
|
|
65
|
+
Math.abs(f[base + 1] - median[base + 1]),
|
|
66
|
+
Math.abs(f[base + 2] - median[base + 2]),
|
|
67
|
+
);
|
|
68
|
+
const far = d >= tolerance;
|
|
69
|
+
if (far) near = false;
|
|
70
|
+
if (prevFar !== null && far !== prevFar) flips += 1;
|
|
71
|
+
prevFar = far;
|
|
72
|
+
}
|
|
73
|
+
if (near) core += 1;
|
|
74
|
+
if (flips >= minFlips) flicker += 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
median,
|
|
79
|
+
coreRatio: +(core / px).toFixed(3),
|
|
80
|
+
flickerRatio: +(flicker / px).toFixed(3),
|
|
81
|
+
pixels: px,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 判定:这一段是"闪烁蒙版"而不是"快速剪辑"。
|
|
87
|
+
*
|
|
88
|
+
* **判据是 flickerRatio(反复翻转的像素比例),不是 coreRatio。** 这是在真素材上量出来的:
|
|
89
|
+
*
|
|
90
|
+
* 窗口 core(全帧) core(≥50%帧) flick(翻转≥3)
|
|
91
|
+
* 3:29-3:30 闪烁段 0.003 0.620 0.739
|
|
92
|
+
* 真快切 46s 0.358 0.923 0.242
|
|
93
|
+
* 真快切 10s 0.000 0.225 0.070
|
|
94
|
+
*
|
|
95
|
+
* core 在真快切上反而更高 —— 因为一个镜头如果占住窗口一半以上的帧,中位数就等于它,
|
|
96
|
+
* 它那几帧全都"贴着中位数"。所以 core 不能用来区分。
|
|
97
|
+
*
|
|
98
|
+
* 能区分的是**时间形态**:真剪辑是一次性从 A 换成 B(每个像素只翻一次),
|
|
99
|
+
* 故障闪烁是像素在底图和噪点之间来回跳(翻很多次)。
|
|
100
|
+
*/
|
|
101
|
+
export function isFlicker({ flickerRatio }, { minFlicker = 0.5 } = {}) {
|
|
102
|
+
return Number.isFinite(flickerRatio) && flickerRatio >= minFlicker;
|
|
103
|
+
}
|
|
104
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* index.js — DSH 插件入口。**只做注册**,四个工具:
|
|
3
|
+
*
|
|
4
|
+
* video_storyboard 全片(或一段)的概览宫格
|
|
5
|
+
* video_zoom 某一段的近距离重看(格少、每格大)
|
|
6
|
+
* video_probe 只读容器头,不花图片 token
|
|
7
|
+
* video_locate 纯文本定位:那句话在第几分钟
|
|
8
|
+
*
|
|
9
|
+
* 陪看(`watch_together`)不在这个包里 —— 它是 **`dsh-watch-together`**,一个单独的插件,
|
|
10
|
+
* 单向依赖本包。本包不 import 它任何一行,所以这里也不注册它的工具。
|
|
11
|
+
*
|
|
12
|
+
* 每个工具的 execute 在 `src/tools/<name>.js` —— 拆开是有原因的:
|
|
13
|
+
* 宿主管参数走的是 schema,**schema 没声明的参数会被直接丢掉**。
|
|
14
|
+
* 所以"handler 读了哪些 args"必须能被静态扫出来,和"schema 声明了哪些"对上;
|
|
15
|
+
* 一个文件里塞五个 handler 就扫不出边界了(见 test/schema-audit.test.mjs)。
|
|
16
|
+
*
|
|
17
|
+
* 契约要点(都是对着 @deepseek-ai/dsh-tools 的类型定义核对的):
|
|
18
|
+
* - `apply` 返回 disposer(把所有 `ctx.tools.register()` 的返回值串起来)
|
|
19
|
+
* - `execute` 返回**规范值**(要过 output.schema)
|
|
20
|
+
* - `output.render(args, value)` 把规范值渲染成 ContentBlock[],图片块是
|
|
21
|
+
* `{ type: 'image', attachment: ImageAttachmentRef }`,ref 必须由
|
|
22
|
+
* `ctx.attachments.saveImage()` 提交过后才能拿到(不能自己编)
|
|
23
|
+
* - saveImage 要的是**真正编码后的字节**(PNG/JPEG),不是裸 RGB —— 它会解码校验
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// 四个视频识别工具各自的注册入口:契约、handler、注册都在 src/storyboard/ 里。
|
|
27
|
+
import { storyboardTools } from './storyboard/register.js';
|
|
28
|
+
|
|
29
|
+
export const name = 'dsh-video-storyboard';
|
|
30
|
+
export const inject = ['tools', 'attachments'];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 解析宿主的 dsh-tools。正常安装时裸包名就能解析;本地开发/测试时
|
|
34
|
+
* 用 DSH_TOOLS_PATH 指向安装里的 lib/index.js。
|
|
35
|
+
*/
|
|
36
|
+
async function loadDefineTool() {
|
|
37
|
+
try {
|
|
38
|
+
const mod = await import('@deepseek-ai/dsh-tools');
|
|
39
|
+
if (mod?.defineTool) return mod.defineTool;
|
|
40
|
+
} catch {
|
|
41
|
+
/* 落到环境变量 */
|
|
42
|
+
}
|
|
43
|
+
const override = process.env.DSH_TOOLS_PATH;
|
|
44
|
+
if (override) {
|
|
45
|
+
const { pathToFileURL } = await import('node:url');
|
|
46
|
+
const mod = await import(pathToFileURL(override).href);
|
|
47
|
+
if (mod?.defineTool) return mod.defineTool;
|
|
48
|
+
}
|
|
49
|
+
throw new Error('cannot resolve @deepseek-ai/dsh-tools (set DSH_TOOLS_PATH for local dev)');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function apply(ctx) {
|
|
53
|
+
try {
|
|
54
|
+
return await registerAll(ctx);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
// **最坏的情况是插件不能用,不是应用起不来**。
|
|
57
|
+
// 真实事故:我在 apply 里加了一次 ctx 探测,`Object.keys(ctx)` 在 cordis 上下文上抛错,
|
|
58
|
+
// 整个 DSH 直接崩在启动阶段("The application could not start")。
|
|
59
|
+
// 从那以后,apply 的异常一律吞掉并记录,交回一个空 disposer。
|
|
60
|
+
try {
|
|
61
|
+
ctx?.logger?.error?.(`[dsh-video-storyboard] failed to load: ${e?.stack ?? e}`);
|
|
62
|
+
} catch { /* 连日志都写不了就算了 */ }
|
|
63
|
+
// DSH_VIDEO_DEBUG=1 时把错误抛出去 —— 否则"插件静默不工作"很难查
|
|
64
|
+
if (process.env.DSH_VIDEO_DEBUG) throw e;
|
|
65
|
+
return () => {};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function registerAll(ctx) {
|
|
70
|
+
const defineTool = await loadDefineTool();
|
|
71
|
+
|
|
72
|
+
const tools = storyboardTools(defineTool, ctx);
|
|
73
|
+
|
|
74
|
+
// **disposers 必须在最前面声明**:它曾经声明在别的钩子之后,于是 `disposers.push(off)`
|
|
75
|
+
// 撞上 const 的暂时性死区,抛 ReferenceError,又被下面的 catch 静默吞掉 ——
|
|
76
|
+
// 工具注册成功了,解绑函数却从来没登记过(插件卸载时不会解绑,而且没人知道出过错)。
|
|
77
|
+
const disposers = [];
|
|
78
|
+
disposers.push(...tools.map((tool) => ctx.tools.register(tool)));
|
|
79
|
+
return () => {
|
|
80
|
+
for (const dispose of disposers.reverse()) dispose?.();
|
|
81
|
+
};
|
|
82
|
+
}
|