import type { Environment } from '../config/environments.js'; import { type GenerationOutcome, type MusicOutcome } from './stream.js'; export interface MusicRequest { gameId: string; prompt: string; /** 10-180; the server refuses anything else before spending. */ durationSeconds: number; instrumental?: boolean; loop?: boolean; assetId?: string; /** The creator's own request, verbatim — recorded server-side for analytics, never generated from. */ creatorPrompt?: string; } export interface MusicDeps { fetch: typeof globalThis.fetch; log: (message: string) => void; } /** A successful generation whose frame carried the track — the only kind a caller can act on. */ export type MusicGeneration = GenerationOutcome & { music: MusicOutcome; }; /** * Request one track. Resolves only with a frame that carries the URLs; a generation the server * reports as failed, or a success frame with no `music` on it, is a CliError here rather than a * value the caller has to inspect — there is nothing to do with either. */ export declare function requestMusic(environment: Environment, accessToken: string, request: MusicRequest, deps: MusicDeps): Promise; /** * Save a track to `outPath`, creating the directory. Returns the byte count. * * A thin naming wrapper over {@link downloadAudioFile}, kept so this lane's error * messages keep saying "the track" where the speech lane says "the line". */ export declare function downloadMusicFile(url: string, outPath: string, fetchImpl: typeof globalThis.fetch): Promise; export interface MusicFileRequest { gameId: string; prompt: string; durationSeconds: number; instrumental?: boolean; creatorPrompt?: string; } export interface MusicFileResult { outPath: string; bytes: number; music: MusicOutcome; } /** * Generate a track and save its MP3 to `outPath`. **Never writes world.json** — this is the * function `bitmagic trailer make --music-prompt` calls, and a trailer's music bed is not a game * asset. The server's patch is dropped on the floor here on purpose. */ export declare function generateMusicFile(environment: Environment, accessToken: string, request: MusicFileRequest, outPath: string, deps: MusicDeps): Promise;