types.ts
tasks/types.ts
47
Lines
1691
Bytes
3
Exports
7
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with tasks-background-jobs. It contains 47 lines, 7 detected imports, and 3 detected exports.
Important relationships
Detected exports
TaskStateBackgroundTaskStateisBackgroundTask
Keywords
taskbackgroundtaskstypesdreamtaskstateinprocessteammatetaskstatelocalagenttaskstatelocalshelltaskstatelocalworkflowtaskstatemonitormcptaskstate
Detected imports
./DreamTask/DreamTask.js./InProcessTeammateTask/types.js./LocalAgentTask/LocalAgentTask.js./LocalShellTask/guards.js./LocalWorkflowTask/LocalWorkflowTask.js./MonitorMcpTask/MonitorMcpTask.js./RemoteAgentTask/RemoteAgentTask.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
// 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 indicator
export 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
}