source dump of claude code
at main 39 lines 1.4 kB view raw
1import { feature } from 'bun:bundle' 2import type { Task, TaskType } from './Task.js' 3import { DreamTask } from './tasks/DreamTask/DreamTask.js' 4import { LocalAgentTask } from './tasks/LocalAgentTask/LocalAgentTask.js' 5import { LocalShellTask } from './tasks/LocalShellTask/LocalShellTask.js' 6import { RemoteAgentTask } from './tasks/RemoteAgentTask/RemoteAgentTask.js' 7 8/* eslint-disable @typescript-eslint/no-require-imports */ 9const LocalWorkflowTask: Task | null = feature('WORKFLOW_SCRIPTS') 10 ? require('./tasks/LocalWorkflowTask/LocalWorkflowTask.js').LocalWorkflowTask 11 : null 12const MonitorMcpTask: Task | null = feature('MONITOR_TOOL') 13 ? require('./tasks/MonitorMcpTask/MonitorMcpTask.js').MonitorMcpTask 14 : null 15/* eslint-enable @typescript-eslint/no-require-imports */ 16 17/** 18 * Get all tasks. 19 * Mirrors the pattern from tools.ts 20 * Note: Returns array inline to avoid circular dependency issues with top-level const 21 */ 22export function getAllTasks(): Task[] { 23 const tasks: Task[] = [ 24 LocalShellTask, 25 LocalAgentTask, 26 RemoteAgentTask, 27 DreamTask, 28 ] 29 if (LocalWorkflowTask) tasks.push(LocalWorkflowTask) 30 if (MonitorMcpTask) tasks.push(MonitorMcpTask) 31 return tasks 32} 33 34/** 35 * Get a task by its type. 36 */ 37export function getTaskByType(type: TaskType): Task | undefined { 38 return getAllTasks().find(t => t.type === type) 39}