import type { FileOps } from "gui-chat-protocol"; import type { MulmoBeat, MulmoStudioContext } from "@mulmocast/types"; import type { MulmoScriptGenerationEvent } from "../core/contract"; import type { GenerateOpArgsWith, MovieGenerationResult, MovieProgressEvent, MulmoScriptServerBackend, OpFailure, OpResult, PdfGenerationResult } from "./types"; type GenerationKind = MulmoScriptGenerationEvent["kind"]; export declare const PDF_MODE: "slide"; export declare const PDF_SIZE: "a4"; export declare function buildContext(absoluteFilePath: string, force?: boolean): Promise; export type StoryContext = NonNullable>>; export interface RunStoryOpDeps { resolveStory?: (filePath: string, root?: string) => { ok: true; absolutePath: string; } | OpFailure; buildContext?: (absoluteFilePath: string, force?: boolean) => Promise; } export interface RunStoryOpOptions { force?: boolean | undefined; /** Which registered stories root `filePath` is relative to (#3014). * Absent = the host's default root, i.e. exactly the pre-roots path. */ root?: string | undefined; /** * Op-specific tag included in the failure log so dashboards can * distinguish which op is failing (e.g. `"generate-beat-audio"`). * Falls back to a generic `"op failed"` entry when omitted. */ operation?: string; /** * Soft-fail override for `buildContext` returning undefined. Some * ops (e.g. `beatAudio`) historically returned a 200 `{ audio: null }` * in that case so the frontend can silently retry. If provided, this * callback returns the fallback result instead of the default * server_error "Failed to initialize mulmo context". */ onContextMissing?: () => OpResult; } export declare function buildBeatIdIndex(beats: MulmoBeat[]): Map; /** * Build the per-host mulmoScript server ops instance. One instance per * process — it owns the in-flight movie/PDF dedup sets and the * generation-state tracker, and binds the injected host backend. */ export declare function createMulmoScriptServerOps(backend: MulmoScriptServerBackend): { backend: MulmoScriptServerBackend; toStoryRef: (absolutePath: string, root?: string) => string | null; outputRef: (outputPath: string, wireFilePath: string, root?: string) => string | null; resolveStory: (filePath: string, root?: string) => { ok: true; absolutePath: string; } | OpFailure; guardStoryWirePath: (filePath: unknown, root?: string) => OpFailure | null; guardStoryRootRegistered: (root: string | undefined) => OpFailure | null; guardStoryWriteRoot: (root: string | undefined) => OpFailure | null; artifactsForRoot: (root: string | undefined) => FileOps | null; guardStoryGenerationRoot: (root: string | undefined) => OpFailure | null; ffmpegGuard: () => OpFailure | null; runStoryOp: (filePath: string, options: RunStoryOpOptions, handler: (ctx: { absoluteFilePath: string; context: StoryContext; }) => Promise>, deps?: RunStoryOpDeps) => Promise>; publishGeneration: (chatSessionId: string | undefined, kind: GenerationKind, filePath: string, key: string, finished: boolean, opts?: { error?: string | undefined; root?: string | undefined; }) => void; publishScriptChanged: (filePath: string, origin?: string, root?: string) => void; pendingGenerations: (filePath: string, root?: string) => MulmoScriptGenerationEvent[]; beatImageOp: (filePath: string, beatIndex: number, root?: string) => Promise>; beatAudioOp: (filePath: string, beatIndex: number, root?: string) => Promise>; beatMovieOp: (filePath: string, beatIndex: number, root?: string) => Promise>; characterImageOp: (filePath: string, key: string, root?: string) => Promise>; movieStatusOp: (filePath: string, root?: string) => Promise>; pdfStatusOp: (filePath: string, root?: string) => Promise>; renderBeatOp: (args: GenerateOpArgsWith<"filePath" | "beatIndex">) => Promise>; generateBeatAudioOp: (args: GenerateOpArgsWith<"filePath" | "beatIndex">) => Promise>; renderCharacterOp: (args: GenerateOpArgsWith<"filePath" | "key">) => Promise>; uploadBeatImageOp: (filePath: string, beatIndex: number, imageData: string, root?: string) => Promise>; uploadCharacterImageOp: (filePath: string, key: string, imageData: string, root?: string) => Promise>; inFlightMovies: Set; inFlightPdfs: Set; runMovieGeneration: (absoluteFilePath: string, onProgressEvent: (event: MovieProgressEvent) => void) => Promise; runPdfGeneration: (context: StoryContext, onImageBeatDone: (beatIndex: number) => void) => Promise; generateMovieOp: (filePath: string, chatSessionId: string | undefined, root?: string) => Promise>; generatePdfOp: (filePath: string, chatSessionId: string | undefined, root?: string) => Promise>; triggerAutoBackgroundMovie: (absoluteFilePath: string, wireFilePath: string, chatSessionId: string | undefined, root?: string) => void; }; export type MulmoScriptServerOps = ReturnType; export {}; //# sourceMappingURL=ops.d.ts.map