import { FunctionEvent, DefaultRun, AsyncQueue } from 'modelfusion'; import { z } from 'zod'; import { FastifyPluginAsync } from 'fastify'; interface Logger { logFunctionEvent(options: { run: FlowRun; event: FunctionEvent; }): Promise; logError(options: { run: FlowRun; message: string; error: unknown; }): Promise; } declare class PathProvider { readonly baseUrl: string; readonly basePath: string; constructor({ baseUrl, basePath }: { baseUrl: string; basePath: string; }); getAssetUrl(runId: string, assetName: string): string; getAssetPathTemplate(): string; getEventsUrl(runId: string): string; getEventsPathTemplate(): string; } declare class FlowRun extends DefaultRun { readonly eventQueue: AsyncQueue; private readonly assetStorage; private readonly logger; private readonly paths; constructor({ paths, assetStorage, logger, }: { paths: PathProvider; assetStorage: AssetStorage; logger: Logger; }); readonly functionObserver: { onFunctionEvent: (event: FunctionEvent) => Promise; }; publishEvent(event: EVENT): void; storeBinaryAsset(asset: Asset): Promise; storeTextAsset(asset: { text: string; contentType: string; name: string; }): Promise; finish(): void; } type Asset = { data: Buffer; contentType: string; name: string; }; interface AssetStorage { storeAsset(options: { run: FlowRun; asset: Asset; }): Promise; readAsset(options: { run: FlowRun; assetName: string; }): Promise; } interface FlowSchema { input: z.ZodType; events: z.ZodType; } declare class DefaultFlow { readonly schema: FlowSchema; constructor({ schema, process, }: { schema: FlowSchema; process: (options: { input: INPUT; run: FlowRun; }) => Promise; }); process: (options: { input: INPUT; run: FlowRun; }) => Promise; } declare class FileSystemAssetStorage implements AssetStorage { private readonly path; private readonly logger; constructor({ path, logger, }: { path: (run: FlowRun) => string; logger: Logger; }); storeAsset({ run, asset, }: { run: FlowRun; asset: Asset; }): Promise; readAsset(options: { run: FlowRun; assetName: string; }): Promise; } declare class FileSystemLogger implements Logger { private readonly logPath; constructor({ path }: { path: (run: FlowRun) => string; }); logFunctionEvent({ run, event, }: { run: FlowRun; event: FunctionEvent; }): Promise; logError({ run, error, message, }: { run: FlowRun; message: string; error: unknown; }): Promise; } interface Flow { readonly schema: FlowSchema; process: (options: { input: INPUT; run: FlowRun; }) => Promise; } interface ModelFusionFastifyPluginOptions { flow: Flow; baseUrl: string; basePath: string; assetStorage: AssetStorage; logger: Logger; } declare const modelFusionFastifyPlugin: FastifyPluginAsync; export { type Asset, type AssetStorage, DefaultFlow, FileSystemAssetStorage, FileSystemLogger, type Flow, FlowRun, type Logger, type ModelFusionFastifyPluginOptions, modelFusionFastifyPlugin };