/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { IExecuteContext, IExecutePreviewContext, TaskConfig, TaskEntitlements, TaskOutput } from "@workglow/task-graph"; import { Task, TaskInput } from "@workglow/task-graph"; import type { ServiceRegistry } from "@workglow/util"; import type { DataPortSchema } from "@workglow/util/schema"; import type { Capability } from "../../capability/Capabilities"; import { AiJob, AiJobInput } from "../../job/AiJob"; import type { ModelConfig } from "../../model/ModelSchema"; export interface AiTaskInput extends TaskInput { model: string | ModelConfig; } /** * A base class for AI related tasks that use an execution strategy * (direct or queued) determined by the provider at registration time. * * Model resolution is handled automatically by the TaskRunner before execution. * By the time execute() is called, input.model is always a ModelConfig object. */ export declare class AiTask = TaskConfig> extends Task { static type: string; static hasDynamicEntitlements: boolean; /** * Capabilities this task requires from the model selected at execution time. * Gates strictly: throws unless `model.capabilities ⊇ task.requires`. * An empty array passes vacuously (pure-compute subclasses that don't dispatch). */ static readonly requires: readonly Capability[]; static entitlements(): TaskEntitlements; entitlements(): TaskEntitlements; static configSchema(): DataPortSchema; /** * Throws TaskConfigurationError if the model lacks any capability listed in * the task class's static `requires`. Both execute() and executeStream() must * call this before dispatch — gating is task-side, not strategy-side. */ protected gateOrThrow(model: ModelConfig): void; execute(input: Input, executeContext: IExecuteContext): Promise; /** * Get the input to submit to the job queue (or direct execution). * Transforms the task input to AiJobInput format. */ protected getJobInput(input: Input): Promise>; /** * Creates a new Job instance for direct execution (without a queue). */ createJob(input: Input, queueName?: string): Promise, Output>>; /** * Gets the default queue name based on the model's provider. */ protected getDefaultQueueName(input: Input): Promise; /** * Delegates to a provider-registered preview run function if one exists, * otherwise falls back to the default Task.executePreview(). */ executePreview(input: Input, context: IExecutePreviewContext): Promise; /** * Validates that model inputs are valid ModelConfig objects. */ validateInput(input: Input): Promise; narrowInput(input: Input, registry: ServiceRegistry): Promise; } //# sourceMappingURL=AiTask.d.ts.map