UNPKG

woolball-client

Version:

Client-side library for Woolball enabling secure browser resource sharing for distributed AI task processing

37 lines (36 loc) 1.31 kB
import { TaskType } from '../utils/tasks'; export type Environment = 'browser' | 'extension' | 'node'; export type ExecutionType = 'browser' | 'worker' | 'node_worker'; export interface TaskConfig { browser?: { type: ExecutionType; handler: string | Function; }; extension?: { type: ExecutionType; handler: string | Function; }; node?: { type: ExecutionType; handler: string | Function; }; } /** * Centralized task configuration following the rules: * - Browser: AI tasks via worker, canvas tasks direct * - Extension: AI tasks direct, canvas tasks unavailable * - Node: AI tasks via node_worker, canvas tasks unavailable */ export declare const TASK_CONFIGS: Record<TaskType, TaskConfig>; /** * Check if a task is available in the given environment */ export declare function isTaskAvailableInEnvironment(taskType: TaskType, environment: Environment): boolean; /** * Get the task handler for a specific task type and environment */ export declare function getTaskHandler(taskType: TaskType, environment: Environment): string | Function | null; /** * Get the execution type for a task in a specific environment */ export declare function getTaskExecutionType(taskType: TaskType, environment: Environment): ExecutionType | null;