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,544 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* storyboard/tool-spec.js — 视频识别那四个工具的 schema 与兜底校验。
|
|
3
|
+
*
|
|
4
|
+
* `video_storyboard` / `video_zoom` / `video_probe` / `video_locate` 的契约都在这里。
|
|
5
|
+
* 陪看那份不在这里 —— `watch_together` 属于另一个包 `dsh-watch-together`,
|
|
6
|
+
* 契约在它的 `src/tool-spec.js`。两边各自持有自己的契约,谁也别去对方目录里改。
|
|
7
|
+
*
|
|
8
|
+
* ## 为什么这份文件值得单独存在
|
|
9
|
+
*
|
|
10
|
+
* 宿主是**按 schema 过滤参数**的:handler 读了、schema 没声明的参数会被静默丢掉,不报错。
|
|
11
|
+
* 这个病今天一次性暴露成四个 PR(#24 #26 #33 + 审计自己扫出来的 loop/ocr/scanHeight/adaptive)。
|
|
12
|
+
* 所以"handler 读了哪些 args"必须能被静态扫出来 —— 一个文件里塞五个 handler 就扫不出边界,
|
|
13
|
+
* 一个文件里塞五份 schema 就会让人改错地方。
|
|
14
|
+
*
|
|
15
|
+
* 加参数时跑 `test/schema-audit.test.mjs`。
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* tool-spec.js — 工具定义(**不含 execute**)。
|
|
20
|
+
*
|
|
21
|
+
* 单独抽出来是为了让 test/contract.test.mjs 能把同一份 spec 丢给宿主真实的
|
|
22
|
+
* `defineTool` 编译一遍。这一步必须做:schema 用了宿主不认的关键字时,
|
|
23
|
+
* `ctx.tools.register()` 会在 apply() 阶段抛错,整棵插件树(连带应用)都起不来。
|
|
24
|
+
*
|
|
25
|
+
* 宿主支持的子集(见 @deepseek-ai/dsh-tools 的 ValueSchemaSpec):
|
|
26
|
+
* string / number / integer / boolean / null / array(items) / object(properties, additionalProperties) / json / oneOf
|
|
27
|
+
* **不支持** minimum、maximum、pattern、maxItems、minLength、format 等注解式约束。
|
|
28
|
+
* 所以取值范围(比如 cells 1..16)写在 description 里,由 execute 兜底校验。
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export const TOOL_NAME = 'video_storyboard';
|
|
32
|
+
export const ZOOM_TOOL_NAME = 'video_zoom';
|
|
33
|
+
export const PROBE_TOOL_NAME = 'video_probe';
|
|
34
|
+
export const LOCATE_TOOL_NAME = 'video_locate';
|
|
35
|
+
|
|
36
|
+
export function storyboardToolSpec() {
|
|
37
|
+
return {
|
|
38
|
+
name: TOOL_NAME,
|
|
39
|
+
description: [
|
|
40
|
+
'Turn a local video into ONE addressable storyboard image (a numbered grid of frames)',
|
|
41
|
+
'plus a text index of every cell, so you can look at the video yourself instead of guessing.',
|
|
42
|
+
'',
|
|
43
|
+
'Each cell is one content segment (shot-aware), sampled at its sharpest frame, with the cell',
|
|
44
|
+
'number burned into the top-left corner. The text lists "cell k (r2c3) = 00:12.76-00:31.40"',
|
|
45
|
+
'so you can cite a moment or ask for a close-up later with video_zoom.',
|
|
46
|
+
'',
|
|
47
|
+
'Use it like this:',
|
|
48
|
+
'- Whole short clip: video_storyboard({ input })',
|
|
49
|
+
'- Long film, read in slices: video_storyboard({ input, from: 600, to: 900 })',
|
|
50
|
+
'- Wide shot of a long film: video_storyboard({ input, cells: 16, sheets: 2 })',
|
|
51
|
+
'',
|
|
52
|
+
'Cell count is chosen automatically from duration and how fast the picture changes',
|
|
53
|
+
'(fast-cut content gets more cells). Pass cells/sheets only if you want to override.',
|
|
54
|
+
].join('\n'),
|
|
55
|
+
parameters: {
|
|
56
|
+
input: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
required: true,
|
|
59
|
+
description: 'Local absolute path (mp4/mov/mkv/webm...), or an http(s) link such as a Bilibili ' +
|
|
60
|
+
'video URL. Links are downloaded once at low resolution for scanning; video_zoom re-reads ' +
|
|
61
|
+
'the original stream at high resolution.',
|
|
62
|
+
},
|
|
63
|
+
from: {
|
|
64
|
+
type: 'number',
|
|
65
|
+
description: 'Window start in seconds (default 0). Only this window is scanned and sampled.',
|
|
66
|
+
},
|
|
67
|
+
to: {
|
|
68
|
+
type: 'number',
|
|
69
|
+
description: 'Window end in seconds (default: end of file).',
|
|
70
|
+
},
|
|
71
|
+
cells: {
|
|
72
|
+
type: 'integer',
|
|
73
|
+
description: 'Cells per image, 1-16 (default: auto). More cells = more coverage but smaller each.',
|
|
74
|
+
},
|
|
75
|
+
sheets: {
|
|
76
|
+
type: 'integer',
|
|
77
|
+
description: 'How many images to return, 1-16 (default: auto). Each image costs another ~384 tokens '
|
|
78
|
+
+ '(16 means ~6k): ask for many only when the user wants a dense pass over a long video. '
|
|
79
|
+
+ 'The auto value is not capped by this — a 66-minute lecture already returns 3.',
|
|
80
|
+
},
|
|
81
|
+
pick: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
enum: ['sharp', 'mid', 'thumb'],
|
|
84
|
+
description: 'Frame selection inside a segment. Default "sharp" (Laplacian variance) avoids blurred transition frames.',
|
|
85
|
+
},
|
|
86
|
+
burn: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
enum: ['index', 'none'],
|
|
89
|
+
description: 'What to burn into each cell. Default "index" (the cell number, so the model can cite ' +
|
|
90
|
+
'"cell 5"). Timecodes are never burned in - they live in the text at 0.01 s precision, and pixels ' +
|
|
91
|
+
'spent on a timecode are pixels lost from the frame.',
|
|
92
|
+
},
|
|
93
|
+
minGap: {
|
|
94
|
+
type: 'number',
|
|
95
|
+
description: 'Minimum spacing between sampled frames in seconds (default 1.2). Short shots get merged, not sampled twice.',
|
|
96
|
+
},
|
|
97
|
+
adaptive: {
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
description: 'Default true: distribute cells by local cut density, so a fast-cutting stretch gets ' +
|
|
100
|
+
'more cells than a static one. Set false for evenly spaced cells across the window — more ' +
|
|
101
|
+
'predictable when you want to compare two windows cell-by-cell.',
|
|
102
|
+
},
|
|
103
|
+
transcript: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
enum: ['auto', 'off'],
|
|
106
|
+
description: 'Default "auto": use the embedded subtitle track if present, otherwise ASR when configured. "off" skips speech entirely.',
|
|
107
|
+
},
|
|
108
|
+
transcriptFile: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: 'Path to an existing transcript (SRT, or JSON with [{start,end,text}] / ' +
|
|
111
|
+
'[{from,to,text}] / Bilibili {body:[{from,to,content}]}). When given, the subtitle track ' +
|
|
112
|
+
'and ASR are both skipped — use this when the site already has captions.',
|
|
113
|
+
},
|
|
114
|
+
planThresholds: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
description: 'Override the content-classification thresholds for this call. Defaults -18 / 1 / 3 ' +
|
|
117
|
+
'are tuned on one master; loudness varies by up to 9 LU across material, so pass your own when ' +
|
|
118
|
+
'the auto plan misfires. The values actually used are always printed in the manifest.',
|
|
119
|
+
properties: {
|
|
120
|
+
musicLufs: { type: 'number', description: 'Louder than this + low speech rate = music-driven' },
|
|
121
|
+
musicSpeechRate: { type: 'number', description: 'Below this chars/s counts as music-like' },
|
|
122
|
+
speechRateCut: { type: 'number', description: 'Above this chars/s, give the transcript more weight' },
|
|
123
|
+
},
|
|
124
|
+
additionalProperties: false,
|
|
125
|
+
},
|
|
126
|
+
ocr: {
|
|
127
|
+
type: 'boolean',
|
|
128
|
+
description: 'Correct ASR text against burned-in on-screen subtitles (local OCR, no extra tokens). ' +
|
|
129
|
+
'Defaults to true when detail=high. Only helps when the video actually has hard-coded subtitles; ' +
|
|
130
|
+
'silently skipped otherwise.',
|
|
131
|
+
},
|
|
132
|
+
hotwords: {
|
|
133
|
+
type: 'string',
|
|
134
|
+
description: 'Space-separated terms to bias this run\'s transcription (e.g. "位错 滑移 柏氏矢量"). ' +
|
|
135
|
+
'Overrides asr.json for this call only. Use it when the subject has its own vocabulary — a global ' +
|
|
136
|
+
'list from another subject is a negative bias, not a neutral default.',
|
|
137
|
+
},
|
|
138
|
+
scanHeight: {
|
|
139
|
+
type: 'integer',
|
|
140
|
+
description: 'For http(s) links: which resolution to download for scanning (default 360). ' +
|
|
141
|
+
'Scanning only needs structure — it gets downscaled to 64x36 — so a low tier is both ' +
|
|
142
|
+
'faster and 15x smaller. Close-ups go through video_zoom instead.',
|
|
143
|
+
},
|
|
144
|
+
cookies: {
|
|
145
|
+
type: 'string',
|
|
146
|
+
description: 'Path to a Netscape cookies.txt for http(s) links. Falls back to DSH_VIDEO_COOKIES. ' +
|
|
147
|
+
'Required by default: without a signed-in session the available resolution is unpredictable ' +
|
|
148
|
+
'and a 1080p tier can simply be absent from the format list.',
|
|
149
|
+
},
|
|
150
|
+
allowAnonymous: {
|
|
151
|
+
type: 'boolean',
|
|
152
|
+
description: 'Anonymous fetching is always allowed. Set this to true to suppress the ' +
|
|
153
|
+
'"resolution not guaranteed" note when you already know this source is fine without cookies.',
|
|
154
|
+
},
|
|
155
|
+
detail: {
|
|
156
|
+
type: 'string',
|
|
157
|
+
enum: ['low', 'med', 'high'],
|
|
158
|
+
description: 'How many characters of transcript per cell: low=60 (is this stretch about X?), ' +
|
|
159
|
+
'med=120 (default), high=400 (quote-level). Truncation lands on a sentence boundary. ' +
|
|
160
|
+
'Use cellRange + textOnly to read one cell in full.',
|
|
161
|
+
},
|
|
162
|
+
cellRange: {
|
|
163
|
+
type: 'array',
|
|
164
|
+
items: { type: 'integer' },
|
|
165
|
+
description: 'Only render cells [first, last] (1-based, inclusive) in the text index. ' +
|
|
166
|
+
'For a 2-hour film the full 64-cell index is ~75 KB, which can exceed one tool result — ' +
|
|
167
|
+
'the index says where it stopped and which cellRange to ask for next.',
|
|
168
|
+
},
|
|
169
|
+
textOnly: {
|
|
170
|
+
type: 'boolean',
|
|
171
|
+
description: 'Return only the text index (respecting cellRange) — no image is produced and no ' +
|
|
172
|
+
'frame is decoded. Use it to page through a long film after the first visual pass; the scan is cached.',
|
|
173
|
+
},
|
|
174
|
+
sourceHash: {
|
|
175
|
+
type: 'boolean',
|
|
176
|
+
description: 'Also compute the source file SHA-256 and put it in the manifest. Off by default: ' +
|
|
177
|
+
'it reads the whole file, so on a multi-GB video it adds real I/O.',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
output: {
|
|
181
|
+
schema: {
|
|
182
|
+
type: 'object',
|
|
183
|
+
additionalProperties: false,
|
|
184
|
+
properties: {
|
|
185
|
+
text: { type: 'string', required: true, description: 'The addressable cell index for the model.' },
|
|
186
|
+
images: {
|
|
187
|
+
type: 'array',
|
|
188
|
+
required: true,
|
|
189
|
+
items: { type: 'json' },
|
|
190
|
+
description: 'Committed image attachments, one per storyboard sheet.',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
render(args, value) {
|
|
195
|
+
return [
|
|
196
|
+
...value.images.map((attachment) => ({ type: 'image', attachment })),
|
|
197
|
+
{ type: 'text', text: value.text },
|
|
198
|
+
];
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
timeoutMs: 300_000,
|
|
202
|
+
isConcurrencySafe() {
|
|
203
|
+
return true;
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* 第二个工具:一段的近距离重看。与 storyboard 共用管线,只是把窗口收窄、格数调少,
|
|
210
|
+
* 于是每格能分到接近原生分辨率的像素。
|
|
211
|
+
*/
|
|
212
|
+
export function zoomToolSpec() {
|
|
213
|
+
return {
|
|
214
|
+
name: ZOOM_TOOL_NAME,
|
|
215
|
+
description: [
|
|
216
|
+
'Re-read a short window of a video at higher per-cell resolution.',
|
|
217
|
+
'',
|
|
218
|
+
'Use it after video_storyboard when one cell needs a closer look: "what exactly is on screen',
|
|
219
|
+
'at 01:12-01:20?" A zoom returns ONE image with few, large cells (default 6), so faces,',
|
|
220
|
+
'subtitles and on-screen text become legible — things a 16-cell overview cannot show.',
|
|
221
|
+
'',
|
|
222
|
+
'Keep the window short (a few seconds to a minute). For another wide pass use video_storyboard.',
|
|
223
|
+
'Costs one image (~384 tokens in DSH, host-dependent), like any other tool result with one image.',
|
|
224
|
+
].join('\n'),
|
|
225
|
+
parameters: {
|
|
226
|
+
input: {
|
|
227
|
+
type: 'string',
|
|
228
|
+
required: true,
|
|
229
|
+
description: 'Local absolute path, or the same http(s) link you passed to video_storyboard. ' +
|
|
230
|
+
'A link is re-read from the original stream at high resolution, so cells here can be ' +
|
|
231
|
+
'sharper than the storyboard even when the scan itself used a low tier.',
|
|
232
|
+
},
|
|
233
|
+
from: { type: 'number', description: 'Window start in seconds. Required unless cellId is given.' },
|
|
234
|
+
to: { type: 'number', description: 'Window end in seconds. Required unless cellId is given.' },
|
|
235
|
+
cells: {
|
|
236
|
+
type: 'integer',
|
|
237
|
+
description: 'Cells for this window, 1-9 (default 6). Fewer cells = bigger each.',
|
|
238
|
+
},
|
|
239
|
+
pick: {
|
|
240
|
+
type: 'string',
|
|
241
|
+
enum: ['sharp', 'mid', 'thumb'],
|
|
242
|
+
description: 'Frame selection inside each cell. Default "sharp".',
|
|
243
|
+
},
|
|
244
|
+
burn: {
|
|
245
|
+
type: 'string',
|
|
246
|
+
enum: ['index', 'none'],
|
|
247
|
+
description: 'What to burn into each cell. Default "index".',
|
|
248
|
+
},
|
|
249
|
+
transcript: {
|
|
250
|
+
type: 'string',
|
|
251
|
+
enum: ['auto', 'off'],
|
|
252
|
+
description: 'Include subtitle/ASR text for this window. Default "auto".',
|
|
253
|
+
},
|
|
254
|
+
transcriptFile: {
|
|
255
|
+
type: 'string',
|
|
256
|
+
description: 'Path to an existing transcript (SRT, or JSON with [{start,end,text}] / '
|
|
257
|
+
+ '[{from,to,text}] / Bilibili {body:[{from,to,content}]}). Skips the subtitle track and ASR.',
|
|
258
|
+
},
|
|
259
|
+
detail: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
enum: ['low', 'med', 'high'],
|
|
262
|
+
description: 'Characters of transcript per cell: low=60, med=120 (default), high=400.',
|
|
263
|
+
},
|
|
264
|
+
cellId: {
|
|
265
|
+
type: 'integer',
|
|
266
|
+
description: 'Zoom by cell number from the last storyboard of this same input (e.g. 3 = the cell ' +
|
|
267
|
+
'labelled 3 in the sheet). Resolves to that cell\'s absolute time range, so you never copy ' +
|
|
268
|
+
'timestamps by hand. Falls back to an error if no cell map is recorded — then pass from/to.',
|
|
269
|
+
},
|
|
270
|
+
minGap: {
|
|
271
|
+
type: 'number',
|
|
272
|
+
description: 'Minimum spacing between cells in seconds (default 1.2). Lower it to 0.3-0.5 ' +
|
|
273
|
+
'when re-reading a fast-cut montage so short shots get their own cell instead of being merged.',
|
|
274
|
+
},
|
|
275
|
+
zoomHeight: {
|
|
276
|
+
type: 'integer',
|
|
277
|
+
description: 'For http(s) links: which resolution to read the original stream at (default 1080). ' +
|
|
278
|
+
'One frame only — cheaper than downloading. Never exceeds what the source itself offers.',
|
|
279
|
+
},
|
|
280
|
+
scanHeight: {
|
|
281
|
+
type: 'integer',
|
|
282
|
+
description: 'For http(s) links: which resolution the downloaded scan copy uses (default 360). ' +
|
|
283
|
+
'Only matters when zoom has to fall back to the local copy because the direct URL expired — ' +
|
|
284
|
+
'raising it makes that fallback sharper at the cost of a bigger download.',
|
|
285
|
+
},
|
|
286
|
+
ocr: {
|
|
287
|
+
type: 'boolean',
|
|
288
|
+
description: 'Force hard-subtitle OCR correction on/off. Default: on only when detail is "high" ' +
|
|
289
|
+
'(it costs ~3 s of local OCR). Set false to keep the raw ASR text even at high detail.',
|
|
290
|
+
},
|
|
291
|
+
cookies: {
|
|
292
|
+
type: 'string',
|
|
293
|
+
description: 'Path to a Netscape cookies.txt. Falls back to DSH_VIDEO_COOKIES.',
|
|
294
|
+
},
|
|
295
|
+
allowAnonymous: {
|
|
296
|
+
type: 'boolean',
|
|
297
|
+
description: 'Anonymous reading is always allowed. Set this to true to suppress the warning note.',
|
|
298
|
+
},
|
|
299
|
+
sourceHash: {
|
|
300
|
+
type: 'boolean',
|
|
301
|
+
description: 'Also compute the source file SHA-256 and put it in the manifest. Off by default.',
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
output: {
|
|
305
|
+
schema: {
|
|
306
|
+
type: 'object',
|
|
307
|
+
additionalProperties: false,
|
|
308
|
+
properties: {
|
|
309
|
+
text: { type: 'string', required: true, description: 'Cell index for this window.' },
|
|
310
|
+
images: { type: 'array', required: true, items: { type: 'json' } },
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
render(args, value) {
|
|
314
|
+
return [
|
|
315
|
+
...value.images.map((attachment) => ({ type: 'image', attachment })),
|
|
316
|
+
{ type: 'text', text: value.text },
|
|
317
|
+
];
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
timeoutMs: 300_000,
|
|
321
|
+
isConcurrencySafe() {
|
|
322
|
+
return true;
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* 第三个工具:只读容器头,几毫秒。让模型在花掉第一张图的 384 token 之前,
|
|
329
|
+
* 先知道"多长、多大、有没有音轨/字幕、按什么粒度读"。
|
|
330
|
+
*/
|
|
331
|
+
export function probeToolSpec() {
|
|
332
|
+
return {
|
|
333
|
+
name: PROBE_TOOL_NAME,
|
|
334
|
+
description: [
|
|
335
|
+
'Read a video\'s container metadata without decoding a single frame: duration, resolution,',
|
|
336
|
+
'frame rate, rotation, audio track, subtitle tracks, and a suggested reading plan.',
|
|
337
|
+
'',
|
|
338
|
+
'Call this FIRST when you do not already know how long the file is. It costs no image tokens.',
|
|
339
|
+
'Then either video_storyboard (overview, or a window) or video_zoom (close-up).',
|
|
340
|
+
].join('\n'),
|
|
341
|
+
parameters: {
|
|
342
|
+
input: {
|
|
343
|
+
type: 'string',
|
|
344
|
+
required: true,
|
|
345
|
+
description: 'Local absolute path, or an http(s) link. For a link this resolves metadata ' +
|
|
346
|
+
'only (no download): title, duration, and the resolutions the source actually offers.',
|
|
347
|
+
},
|
|
348
|
+
cookies: {
|
|
349
|
+
type: 'string',
|
|
350
|
+
description: 'Path to a Netscape cookies.txt. Falls back to DSH_VIDEO_COOKIES.',
|
|
351
|
+
},
|
|
352
|
+
allowAnonymous: {
|
|
353
|
+
type: 'boolean',
|
|
354
|
+
description: 'Anonymous probing is always allowed. Set this to true to suppress the warning note.',
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
output: {
|
|
358
|
+
schema: {
|
|
359
|
+
type: 'object',
|
|
360
|
+
additionalProperties: false,
|
|
361
|
+
properties: {
|
|
362
|
+
text: { type: 'string', required: true, description: 'Metadata plus a suggested reading plan.' },
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
render(args, value) {
|
|
366
|
+
return [{ type: 'text', text: value.text }];
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
timeoutMs: 30_000,
|
|
370
|
+
isConcurrencySafe() {
|
|
371
|
+
return true;
|
|
372
|
+
},
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** execute 内部兜底校验(schema 子集不支持 minimum/maximum,只能在这里挡) */
|
|
377
|
+
export function validateToolArgs(args) {
|
|
378
|
+
const problems = [];
|
|
379
|
+
if (!args?.input || typeof args.input !== 'string') problems.push('input is required');
|
|
380
|
+
if (args.cells !== undefined && (!Number.isInteger(args.cells) || args.cells < 1 || args.cells > 16)) {
|
|
381
|
+
problems.push('cells must be an integer 1..16');
|
|
382
|
+
}
|
|
383
|
+
if (args.sheets !== undefined && (!Number.isInteger(args.sheets) || args.sheets < 1 || args.sheets > 16)) {
|
|
384
|
+
problems.push('sheets must be an integer 1..16');
|
|
385
|
+
}
|
|
386
|
+
if (args.from !== undefined && args.from < 0) problems.push('from must be >= 0');
|
|
387
|
+
if (args.to !== undefined && args.from !== undefined && args.to <= args.from) {
|
|
388
|
+
problems.push('to must be greater than from');
|
|
389
|
+
}
|
|
390
|
+
if (args.minGap !== undefined && !(args.minGap >= 0)) problems.push('minGap must be >= 0');
|
|
391
|
+
if (args.transcript !== undefined && !['auto', 'off'].includes(args.transcript)) {
|
|
392
|
+
problems.push("transcript must be 'auto' or 'off'");
|
|
393
|
+
}
|
|
394
|
+
if (args.cellRange !== undefined) {
|
|
395
|
+
const r = args.cellRange;
|
|
396
|
+
if (!Array.isArray(r) || r.length !== 2 || r.some((v) => !Number.isInteger(v))) {
|
|
397
|
+
problems.push('cellRange must be two integers: [first, last]');
|
|
398
|
+
} else if (r[0] < 1 || r[1] < r[0]) {
|
|
399
|
+
problems.push('cellRange must satisfy 1 <= first <= last');
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (args.textOnly !== undefined && typeof args.textOnly !== 'boolean') {
|
|
403
|
+
problems.push('textOnly must be a boolean');
|
|
404
|
+
}
|
|
405
|
+
if (args.sourceHash !== undefined && typeof args.sourceHash !== 'boolean') {
|
|
406
|
+
problems.push('sourceHash must be a boolean');
|
|
407
|
+
}
|
|
408
|
+
if (args.detail !== undefined && !['low', 'med', 'high'].includes(args.detail)) {
|
|
409
|
+
problems.push("detail must be 'low', 'med' or 'high'");
|
|
410
|
+
}
|
|
411
|
+
if (args.transcriptFile !== undefined
|
|
412
|
+
&& (typeof args.transcriptFile !== 'string' || args.transcriptFile.trim() === '')) {
|
|
413
|
+
problems.push('transcriptFile must be a non-empty path');
|
|
414
|
+
}
|
|
415
|
+
if (args.scanHeight !== undefined
|
|
416
|
+
&& (!Number.isInteger(args.scanHeight) || args.scanHeight < 120 || args.scanHeight > 2160)) {
|
|
417
|
+
problems.push('scanHeight must be an integer 120..2160');
|
|
418
|
+
}
|
|
419
|
+
if (args.cookies !== undefined && (typeof args.cookies !== 'string' || args.cookies.trim() === '')) {
|
|
420
|
+
problems.push('cookies must be a non-empty path');
|
|
421
|
+
}
|
|
422
|
+
if (args.allowAnonymous !== undefined && typeof args.allowAnonymous !== 'boolean') {
|
|
423
|
+
problems.push('allowAnonymous must be a boolean');
|
|
424
|
+
}
|
|
425
|
+
if (args.adaptive !== undefined && typeof args.adaptive !== 'boolean') {
|
|
426
|
+
problems.push('adaptive must be a boolean');
|
|
427
|
+
}
|
|
428
|
+
if (args.ocr !== undefined && typeof args.ocr !== 'boolean') {
|
|
429
|
+
problems.push('ocr must be a boolean');
|
|
430
|
+
}
|
|
431
|
+
return problems;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** video_zoom 的兜底校验 */
|
|
435
|
+
export function validateZoomArgs(args) {
|
|
436
|
+
const problems = [];
|
|
437
|
+
if (!args?.input || typeof args.input !== 'string') problems.push('input is required');
|
|
438
|
+
const hasCell = args?.cellId !== undefined && args?.cellId !== null;
|
|
439
|
+
if (!hasCell) {
|
|
440
|
+
if (!(args?.from >= 0)) problems.push('from is required and must be >= 0 (or pass cellId)');
|
|
441
|
+
if (!(args?.to > 0)) problems.push('to is required and must be > 0 (or pass cellId)');
|
|
442
|
+
} else if (!Number.isInteger(args.cellId) || args.cellId < 1) {
|
|
443
|
+
problems.push('cellId must be a positive integer');
|
|
444
|
+
}
|
|
445
|
+
if (args?.from !== undefined && args?.to !== undefined && args.to <= args.from) {
|
|
446
|
+
problems.push('to must be greater than from');
|
|
447
|
+
}
|
|
448
|
+
if (args.cells !== undefined && (!Number.isInteger(args.cells) || args.cells < 1 || args.cells > 9)) {
|
|
449
|
+
problems.push('cells must be an integer 1..9');
|
|
450
|
+
}
|
|
451
|
+
if (args.minGap !== undefined && !(args.minGap >= 0)) problems.push('minGap must be >= 0');
|
|
452
|
+
if (args.zoomHeight !== undefined
|
|
453
|
+
&& (!Number.isInteger(args.zoomHeight) || args.zoomHeight < 120 || args.zoomHeight > 2160)) {
|
|
454
|
+
problems.push('zoomHeight must be an integer 120..2160');
|
|
455
|
+
}
|
|
456
|
+
if (args.cookies !== undefined && (typeof args.cookies !== 'string' || args.cookies.trim() === '')) {
|
|
457
|
+
problems.push('cookies must be a non-empty path');
|
|
458
|
+
}
|
|
459
|
+
if (args.allowAnonymous !== undefined && typeof args.allowAnonymous !== 'boolean') {
|
|
460
|
+
problems.push('allowAnonymous must be a boolean');
|
|
461
|
+
}
|
|
462
|
+
if (args.transcript !== undefined && !['auto', 'off'].includes(args.transcript)) {
|
|
463
|
+
problems.push("transcript must be 'auto' or 'off'");
|
|
464
|
+
}
|
|
465
|
+
if (args.transcriptFile !== undefined
|
|
466
|
+
&& (typeof args.transcriptFile !== 'string' || args.transcriptFile.trim() === '')) {
|
|
467
|
+
problems.push('transcriptFile must be a non-empty path');
|
|
468
|
+
}
|
|
469
|
+
if (args.detail !== undefined && !['low', 'med', 'high'].includes(args.detail)) {
|
|
470
|
+
problems.push("detail must be 'low', 'med' or 'high'");
|
|
471
|
+
}
|
|
472
|
+
if (args.ocr !== undefined && typeof args.ocr !== 'boolean') {
|
|
473
|
+
problems.push('ocr must be a boolean');
|
|
474
|
+
}
|
|
475
|
+
if (args.scanHeight !== undefined
|
|
476
|
+
&& (!Number.isInteger(args.scanHeight) || args.scanHeight < 120 || args.scanHeight > 2160)) {
|
|
477
|
+
problems.push('scanHeight must be an integer 120..2160');
|
|
478
|
+
}
|
|
479
|
+
if (args.sourceHash !== undefined && typeof args.sourceHash !== 'boolean') {
|
|
480
|
+
problems.push('sourceHash must be a boolean');
|
|
481
|
+
}
|
|
482
|
+
return problems;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* video_locate — 纯文本的"那句话在第几分钟"。
|
|
487
|
+
*
|
|
488
|
+
* 刻意不读帧、不出图:定位靠的是转写文本,本来就在手里。
|
|
489
|
+
* 模型拿到时间窗之后自己去 video_zoom,省掉一次整段的重新取帧。
|
|
490
|
+
*/
|
|
491
|
+
export function locateToolSpec() {
|
|
492
|
+
return {
|
|
493
|
+
name: LOCATE_TOOL_NAME,
|
|
494
|
+
description: [
|
|
495
|
+
'Find where a phrase is spoken in a video: returns timestamped transcript lines that match,',
|
|
496
|
+
'best first. Text only - no frame decode, no image, no tokens spent on pixels.',
|
|
497
|
+
'',
|
|
498
|
+
'Use this when you know roughly what was said but not when ("where does it mention X").',
|
|
499
|
+
'Then pass the returned from/to window to video_zoom to see that moment.',
|
|
500
|
+
'',
|
|
501
|
+
'Needs a transcript. If video_storyboard already ran on this file in this session, its',
|
|
502
|
+
'transcript is reused; otherwise ASR runs for the requested window (slow if the window is long).',
|
|
503
|
+
].join('\n'),
|
|
504
|
+
parameters: {
|
|
505
|
+
input: {
|
|
506
|
+
type: 'string',
|
|
507
|
+
required: true,
|
|
508
|
+
description: 'Local absolute path or http(s) link. Must be the same string used for ' +
|
|
509
|
+
'video_storyboard if you want its transcript reused.',
|
|
510
|
+
},
|
|
511
|
+
query: {
|
|
512
|
+
type: 'string',
|
|
513
|
+
required: true,
|
|
514
|
+
description: 'The phrase to look for. Chinese and English both work; punctuation and spacing ' +
|
|
515
|
+
'are ignored. Long quotes match better than single characters.',
|
|
516
|
+
},
|
|
517
|
+
from: { type: 'number', description: 'Only search after this second. Default: start of file.' },
|
|
518
|
+
to: { type: 'number', description: 'Only search before this second. Default: end of file.' },
|
|
519
|
+
max: { type: 'number', description: 'How many matches to return, 1-20. Default 5.' },
|
|
520
|
+
transcriptFile: {
|
|
521
|
+
type: 'string',
|
|
522
|
+
description: 'Path to an existing SRT/JSON transcript. Skips ASR entirely.',
|
|
523
|
+
},
|
|
524
|
+
cookies: { type: 'string', description: 'cookies.txt path for login-gated sources.' },
|
|
525
|
+
allowAnonymous: { type: 'boolean', description: 'Allow anonymous fetches for links.' },
|
|
526
|
+
},
|
|
527
|
+
output: {
|
|
528
|
+
schema: {
|
|
529
|
+
type: 'object',
|
|
530
|
+
additionalProperties: false,
|
|
531
|
+
properties: {
|
|
532
|
+
text: { type: 'string', required: true, description: 'Timestamped matching lines, best first.' },
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
render(args, value) {
|
|
536
|
+
return [{ type: 'text', text: value.text }];
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
timeoutMs: 120_000,
|
|
540
|
+
isConcurrencySafe() {
|
|
541
|
+
return true;
|
|
542
|
+
},
|
|
543
|
+
};
|
|
544
|
+
}
|