| from core.registry.tasks_registry import TASKS | |
| # ------------------------------------------------ | |
| # Return categorized tasks (UI Builder uses this) | |
| # ------------------------------------------------ | |
| def get_tasks(): | |
| return TASKS | |
| # ------------------------------------------------ | |
| # Flatten tasks across categories | |
| # ------------------------------------------------ | |
| def get_all_tasks(): | |
| tasks = [] | |
| for category, items in TASKS.items(): | |
| for task in items: | |
| task_copy = dict(task) | |
| task_copy["category"] = category | |
| tasks.append(task_copy) | |
| return tasks | |
| # ------------------------------------------------ | |
| # Execution map | |
| # id -> callable | |
| # ------------------------------------------------ | |
| def get_task_map(): | |
| task_map = {} | |
| for category, items in TASKS.items(): | |
| for task in items: | |
| if "handler" not in task: | |
| raise RuntimeError( | |
| f"Task '{task['id']}' missing handler" | |
| ) | |
| task_map[task["id"]] = task["handler"] | |
| return task_map |