import * as z from "zod"; import { Id } from "./ids.js"; /** * Cut-point finding for talking-head and social video: the `remove_silence` step of * `edit_video` and the read-only `analyze_video` operation, which reports where cuts fit. */ /** Defaults of `remove_silence`; `analyze_video` reports silences with the same ones. */ export const SILENCE_DEFAULTS = { /** Quieter than this (dBFS) counts as silence: below speech, above a typical noise floor. */ thresholdDb: -35, /** Shorter pauses are the rhythm of speech and stay. */ minSilence: 0.6, /** Kept on both sides of what is cut, so breaths and word onsets are not clipped. */ padding: 0.12, } as const; /** Cuts every pause and keeps sound and picture in sync, like a keep step over the speech. */ export const RemoveSilenceStepSchema = z.object({ op: z.literal("remove_silence"), threshold_db: z.number().min(-60).max(-10).default(SILENCE_DEFAULTS.thresholdDb), min_silence: z.number().min(0.2).max(5).default(SILENCE_DEFAULTS.minSilence), padding: z.number().min(0).max(1).default(SILENCE_DEFAULTS.padding), }); export type RemoveSilenceStep = z.infer; export const AnalyzeVideoInputSchema = z.object({ artifact_id: Id, scenes: z.boolean().default(true), silences: z.boolean().default(true), loudness: z.boolean().default(true), /** Written by the bot in the user's language; shown on the media card. */ title: z.string().trim().min(1).max(120), }); export type AnalyzeVideoInput = z.infer;