import { VISION_TRANSCRIBE } from "./contract.js"; import { type VisionEnv } from "./env.js"; import type { CallContext, CallSetup } from "./host.js"; import type { CodeGlobal } from "./see.js"; /** A word and where it is, in seconds from the start of the file. */ export type TranscriptWord = { readonly text: string; readonly start: number; readonly end: number; }; /** What a transcriber answers: the words, the text, the model that answered, and the file's length when the provider * says it. */ export type Transcript = { readonly words: readonly TranscriptWord[]; readonly text: string; readonly model?: string; readonly durationS?: number; }; /** A speech-to-text model as the host reaches it. It holds its own key; nothing it returns carries the key. */ export type Transcriber = { readonly provider: string; readonly model: string; /** The largest file one request takes, in bytes, and how the miss names it; a bigger file is an `over_budget` miss * before any request. */ readonly maxBytes?: number; readonly limit?: string; /** The list price per audio minute. Absent, a transcript's price is unknown (null), never 0. */ readonly usdPerMinute?: number; /** Throws a `ProviderMiss` only before it sends a request; anything else it throws may have been billed. */ transcribe(audio: { readonly bytes: Uint8Array; readonly mimeType: string; readonly name: string; }, options: { readonly language?: string; }, signal?: AbortSignal): Promise; }; /** What `vision.transcribe` is asked: the file, the part of it (a `#t=` fragment) and a language the speech is in, when known. */ export type TranscribeRequest = { readonly path: string; readonly fragment?: string; readonly language?: string; }; /** What `vision.transcribe` gives back: the words with their seconds, the text, who answered and with which model, the price (null when unknown) and the receipts filed. */ export type TranscribeAnswer = { readonly words: readonly TranscriptWord[]; readonly text: string; readonly provider: string; readonly model: string; readonly costUsd: number | null; readonly receipts: readonly string[]; readonly kept?: true; }; /** `vision.transcribe` as a code-mode global: the contract's words and `execute`, which has a speech-to-text model write what a recording says. */ export type TranscribeGlobal = CodeGlobal; /** One `vision.transcribe` call: the file read through the call's environment, asked once, filed and told. */ export declare function transcribe(input: unknown, env: VisionEnv | undefined, call: CallContext, setup: CallSetup): Promise;