cmvr-visual/frontend/src/types.ts

47 lines
3.7 KiB
TypeScript

export type TaskType = 'image.generate' | 'video.generate' | 'defect.generate' | 'audio.transcribe' | 'audio.speech' | 'math.solve' | 'media.structure' | 'video.compose'
export type AssetKind = 'image' | 'video' | 'audio' | 'text' | 'json'
export type JobState = 'needs_attention' | 'paused' | 'waiting_window' | 'scheduled' | 'submitting' | 'queued' | 'running' | 'collecting' | 'cancelling' | 'succeeded' | 'failed' | 'cancelled' | 'timed_out'
export interface User { id: string; username: string; display_name: string; role: string; must_change_password?: boolean; disabled?: boolean }
export interface AuthResponse { user: User; csrf_token: string; public_access?: boolean }
export interface Asset {
id: string; name: string; kind: AssetKind; mime_type: string; size_bytes: number
width: number | null; height: number | null; duration_seconds: number | null
preview_url: string; thumbnail_url: string | null; download_url: string
source_job_id: string | null; origin: 'upload' | 'generated' | 'shared'; tags: string[]; favorite: boolean; created_at: string
}
export interface SharedAsset {
id: string; name: string; kind: AssetKind; mime_type: string; size_bytes: number
width: number | null; height: number | null; duration_seconds: number | null; tags: string[]; created_at: string
publisher_id: string; publisher_name: string; is_owner: boolean; version: number
preview_url: string; thumbnail_url: string | null; download_url: string
}
export interface DeletedRecords { job_ids: string[]; run_ids: string[]; draft_ids: string[]; batch_ids: string[] }
export interface DeleteResult { deleted: DeletedRecords }
export interface NumericConstraint { min?: number; max?: number; step?: number; values?: (string | number)[] }
export interface Capability {
task_type: TaskType; label: string; model: string; available: boolean; input_types: string[]
defaults: Record<string, any>; constraints: Record<string, any>; description: string
}
export interface Scheduler {
available: boolean; state: string; reason: string | null
gpus: { index: number; name: string; busy: boolean; eligible: boolean; free_gib: number | null }[]
updated_at: string | null
}
export interface Job {
run_id?: string | null; step_key?: string | null; batch_id?: string | null; execution_mode?: string; hold_reasons?: string[]; desired_state?: string;
id: string; task_type: TaskType; state: JobState; phase: string; version: number; prompt: string
parameters: Record<string, any>; input_asset_ids: string[]; result_assets: Asset[]; result: Record<string, any> | null
progress: number | null; queue_position: number | null; upstream_id: string | null
attempt_count: number; preemptions: number; last_preempted_reason: string | null; cancel_requested: boolean
error: { code: string; message: string; retriable: boolean } | null; sync_warning: string | null
created_at: string; scheduled_at: string | null; started_at: string | null; finished_at: string | null
}
export interface JobRequest {
task_type: TaskType; input: Record<string, any>; parameters: Record<string, any>; count?: number; execution_mode?: 'interactive' | 'batch'; scheduled_at?: string | null
}
export interface Page<T> { items: T[]; total: number; page: number; page_size: number }
export interface JobsPage extends Page<Job> { cursor: number }
export interface ExecutionPolicy {timezone:string;start:string;end:string;batch_open:boolean;next_batch_at:string|null;close_behavior:string;batch_window_enabled:boolean;configuration_error?:string|null}
export interface WorkflowLimits {max_shots:number;source_frames:number;max_clip_frames:number;fps:number}
export interface CapabilitiesResponse { items: Capability[]; scheduler: Scheduler; execution_policy?:ExecutionPolicy;workflow_limits?:WorkflowLimits }