import { ComputedRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue'; import { JobListPayload, JobState, JobStateInput, JobStreamData } from '../types/jobs'; import { UsePluginEventStreamReturn } from './usePluginClient'; export type JobsStatusTrayTab = 'active' | 'history'; /** * The canonical owner of a collection of plugin jobs. * * Sources, rather than job-center UI, own polling, event streams, and all job * mutations. This keeps components and consumers on one reactive job graph. */ export interface PluginJobCenterSource { jobs: MaybeRefOrGetter; refreshJobs?: () => Promise; cancelJob?: (jobId: string) => Promise; deleteJob?: (jobId: string) => Promise; clearFinishedJobs?: () => Promise; dispose?: () => void; } export interface CombinedPluginJobCenterSource extends PluginJobCenterSource { jobs: ComputedRef; } /** * Combines independent job runtimes without copying their reactive state. * * Job ids must be globally unique across the sources. A duplicate id throws * when jobs are read or an id-routed action is requested, rather than silently * dispatching a mutation to the wrong owner. */ export declare function combinePluginJobSources(sources: readonly PluginJobCenterSource[]): CombinedPluginJobCenterSource; /** @deprecated Removed in MINT 1.4; prefer a {@link PluginJobCenterSource}. */ export interface JobsStatusTrayAdapter { listJobs?: () => Promise; cancelJob?: (job: JobState) => Promise; deleteJob?: (job: JobState) => Promise; clearFinishedJobs?: (jobs: readonly JobState[]) => Promise; } export interface UsePluginJobCenterOptions { source?: MaybeRefOrGetter; /** @deprecated Removed in MINT 1.4; pass a source with its canonical jobs ref. */ jobs?: MaybeRefOrGetter; /** @deprecated Removed in MINT 1.4; pass source actions instead. */ adapter?: MaybeRefOrGetter; /** @deprecated Removed in MINT 1.4; event handling belongs to the source runtime. */ eventStream?: MaybeRefOrGetter | undefined>; loadOnMount?: boolean; } export interface UseJobsStatusTrayOptions extends UsePluginJobCenterOptions { } export interface JobStreamMessage { event: string; data: JobStreamData; } export interface UsePluginJobCenterReturn { jobs: ComputedRef; activeJobs: ComputedRef; historyJobs: ComputedRef; deletableJobs: ComputedRef; featuredJob: ComputedRef; canRefresh: ComputedRef; canCancel: ComputedRef; canDelete: ComputedRef; canClearFinished: ComputedRef; isOpen: Ref; activeTab: Ref; isLoading: Ref; error: ShallowRef; pendingJobIds: Ref>; open: () => void; close: () => void; toggle: () => void; refresh: () => Promise; applyStreamMessage: (message: JobStreamMessage) => void; cancelJob: (job: JobState) => Promise; deleteJob: (job: JobState) => Promise; clearFinished: () => Promise; isPending: (job: JobState) => boolean; } export type UseJobsStatusTrayReturn = UsePluginJobCenterReturn; /** * Headless controller for plugin job presentation and actions. * * When a source is supplied, every job list is derived directly from that * source. The controller never mirrors source jobs into another ref. */ export declare function usePluginJobCenter(options?: UsePluginJobCenterOptions): UsePluginJobCenterReturn; /** @deprecated Removed in MINT 1.4; use `usePluginJobCenter()` for the plugin job-center controller. */ export declare function useJobsStatusTray(options?: UseJobsStatusTrayOptions): UseJobsStatusTrayReturn;