To cut a social video well the bot has to know where the cuts fit, and it could not look at a video at all. analyze_video is a read-only media job: one ffmpeg pass prints scene changes (scene score above 0.3, one per cut), pauses (silencedetect with the remove_silence defaults) and short-term loudness (ebur128) to files in the job directory, and a transcript made from the video by transcribe (an SRT whose parent is the video) adds when each line is spoken. The job stores nothing; its card just says done. The result reaches the bot through the existing media job path: the job always wakes the bot that started it (the tool has no continue_after) and the summary carries a short legend plus compact JSON. The runtime's summary limit grows to 12,000 characters and the summary is fitted into it: at most 200 entries per list, then every list shrinks evenly, keeping the strongest cuts, the longest pauses and the start of the transcript, with omitted counts. The wake prompt no longer claims the card shows the result when a job made no files. Jobs read derived artifacts through a new fetchDerivedArtifact, scoped to the job's user like fetchArtifact. A migration admits the operation in the media_jobs check and adds the tool to existing Studio specialists that still edit video. The web card gets an icon; no new copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
15 lines
731 B
SQL
15 lines
731 B
SQL
-- analyze_video jobs read a video and report its cut points to the bot; they store no files.
|
|
ALTER TABLE "media_jobs" DROP CONSTRAINT "media_jobs_operation_chk";
|
|
ALTER TABLE "media_jobs" ADD CONSTRAINT "media_jobs_operation_chk" CHECK ("operation" IN (
|
|
'generate_image', 'generate_video', 'edit_image', 'edit_video', 'export_video', 'transcribe',
|
|
'analyze_video'
|
|
));
|
|
|
|
-- Studio specialists keep every media tool; ones that still edit video get the new one.
|
|
UPDATE "bots"
|
|
SET "allowedBuiltinTools" = array_append("allowedBuiltinTools", 'analyze_video')
|
|
WHERE "spawnKey" LIKE 'media:studio:%'
|
|
AND "restrictBuiltinTools"
|
|
AND 'edit_video' = ANY("allowedBuiltinTools")
|
|
AND NOT ('analyze_video' = ANY("allowedBuiltinTools"));
|