from typing import Dict
import inspect


def find_all_avail_tasks() -> Dict:
    """
    Finds and returns the list of callable tasks.
    Within FabSim3, each function that wrapped by @task can be called from
    command line.
    Returns:
        array of function object
    """
    f_globals = inspect.stack()[1][0].f_globals
    avail_tasks = {
        k: v for k, v in f_globals.items()
        if callable(v) and hasattr(v, "__wrapped__")
    }

    return avail_tasks