/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { CachePolicy, IRunConfig, TaskConfig } from "@workglow/task-graph"; import { CreateWorkflow } from "@workglow/task-graph"; import { DataPortSchema } from "@workglow/util/schema"; import type { ModelConfig } from "../model/ModelSchema"; import { AiTask } from "./base/AiTask"; export type ModelDownloadTaskRunInput = { model: string | ModelConfig; }; export type ModelDownloadTaskRunOutput = { model: string | ModelConfig; }; export type ModelDownloadTaskConfig = TaskConfig; /** * Download a model from a remote source and cache it locally. * * @remarks * This task has a side effect of downloading the model and caching it locally outside of the task system */ export declare class ModelDownloadTask extends AiTask { static type: string; /** * Resolves to the provider's `["model.download"]` run-fn registration. * Local providers (HFT, LlamaCpp) opt-in by registering a run-fn with * `serves: ["model.download"]`; cloud providers don't register one and * `ModelDownloadTask` for cloud models surfaces as a runtime "no run-fn * for provider serving model.download" error. */ static readonly requires: ["model.download"]; /** * Provider-lifecycle override: `requires: ["model.download"]` routes the * dispatcher to the provider's download run-fn, but the *model* record * doesn't need to advertise `model.download` in its `capabilities` — * a model that's not yet downloaded by definition can't carry that flag * yet. Skip the capability gate; the dispatcher's `getRunFnFor` lookup * (against the provider, not the model record) is the real check. */ protected gateOrThrow(_model: ModelConfig): void; static category: string; static title: string; static description: string; static inputSchema(): DataPortSchema; static outputSchema(): DataPortSchema; static cachePolicy: CachePolicy; files: { file: string; progress: number; }[]; constructor(config?: Partial); /** * Handles progress updates for the download task * @param progress - The progress value (0-100), or `undefined` for indeterminate * @param message - The message to display * @param details - Additional details about the progress */ processProgress(progress: number | undefined, message?: string, details?: { file?: string; progress?: number; /** Full snapshot (e.g. Hugging Face transformers pipeline); per-file % derived from loaded/total */ files?: Record; text?: number; }): void; } /** * Download a model from a remote source and cache it locally. * * @param input - Input containing model(s) to download * @returns Promise resolving to the downloaded model(s) */ export declare const downloadModel: (input: ModelDownloadTaskRunInput, config?: ModelDownloadTaskConfig, runConfig?: Partial) => Promise; declare module "@workglow/task-graph" { interface Workflow { downloadModel: CreateWorkflow; } } //# sourceMappingURL=ModelDownloadTask.d.ts.map