evOo-local/packages/contracts/src/media-transcription.ts
Claude 5e0b09d9c1
feat(media): transcription input, chunked transcripts and the Studio trigger
Groundwork for the transcribe operation and for creating Studio when it is
first needed.

- Contracts: TranscribeInputSchema (artifact id, optional language code).
- transcribeChunks uploads audio chunks in order and stitches them into one
  transcript on the original timeline; transcriptionChunkSeconds sizes
  16 kHz mono WAV chunks below the server's upload limit; transcriptSummary
  hands the bot the transcript, cut at a word.
- ensureStudioWhenMediaConfigured creates Studio once a media server
  (generation or transcription) is configured. Local edits alone do not
  count, because ffmpeg and image tools are present on most installs and a
  specialist nobody asked for would appear for everyone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
2026-10-03 13:35:21 +00:00

14 lines
479 B
TypeScript

import * as z from "zod";
import { Id } from "./ids.js";
export const TranscribeInputSchema = z.object({
artifactId: Id.describe("Audio or video artifact to transcribe."),
language: z
.string()
.trim()
.regex(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/, "Use a language code such as en or de")
.optional()
.describe("Spoken language as a code such as en or de; detected when omitted."),
});
export type TranscribeInput = z.infer<typeof TranscribeInputSchema>;