Something went wrong. Try again.
source dump of claude code forked from oppi.li/claude-code
Something went wrong. Try again.
1.7 kB · 46 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647// Union of all concrete task state types// Use this for components that need to work with any task type
import type { DreamTaskState } from './DreamTask/DreamTask.js'import type { InProcessTeammateTaskState } from './InProcessTeammateTask/types.js'import type { LocalAgentTaskState } from './LocalAgentTask/LocalAgentTask.js'import type { LocalShellTaskState } from './LocalShellTask/guards.js'import type { LocalWorkflowTaskState } from './LocalWorkflowTask/LocalWorkflowTask.js'import type { MonitorMcpTaskState } from './MonitorMcpTask/MonitorMcpTask.js'import type { RemoteAgentTaskState } from './RemoteAgentTask/RemoteAgentTask.js'
export type TaskState = | LocalShellTaskState | LocalAgentTaskState | RemoteAgentTaskState | InProcessTeammateTaskState | LocalWorkflowTaskState | MonitorMcpTaskState | DreamTaskState
// Task types that can appear in the background tasks indicatorexport type BackgroundTaskState = | LocalShellTaskState | LocalAgentTaskState | RemoteAgentTaskState | InProcessTeammateTaskState | LocalWorkflowTaskState | MonitorMcpTaskState | DreamTaskState
/** * Check if a task should be shown in the background tasks indicator. * A task is considered a background task if: * 1. It is running or pending * 2. It has been explicitly backgrounded (not a foreground task) */export function isBackgroundTask(task: TaskState): task is BackgroundTaskState { if (task.status !== 'running' && task.status !== 'pending') { return false } // Foreground tasks (isBackgrounded === false) are not yet "background tasks" if ('isBackgrounded' in task && task.isBackgrounded === false) { return false } return true}