def __init__(
        self,
        app_dir: Optional[str] = None,
        use_local_uri: Optional[bool] = None,
        config: Optional[Dict[str, Any]] = None,
        **kwargs: Any,
    ) -> None:
        """
        Initialize the TaskWeaver app.
        :param app_dir: The project directory.
        :param use_local_uri: Whether to use local URI for artifacts.
        :param config: The configuration.
        :param kwargs: The additional arguments.
        """

        app_dir, is_valid, _ = TaskWeaverApp.discover_app_dir(app_dir)
        app_config_file = path.join(app_dir, "taskweaver_config.json") if is_valid else None
        config = {
            **(config or {}),
            **(kwargs or {}),
        }
        if use_local_uri is not None:
            config["use_local_uri"] = use_local_uri

        config_src = AppConfigSource(
            config_file_path=app_config_file,
            config=config,
            app_base_path=app_dir,
        )
        self.app_injector = Injector(
            [SessionManagerModule, PluginModule, LoggingModule, ExecutionServiceModule, RoleModule],
        )
        self.app_injector.binder.bind(AppConfigSource, to=config_src)
        self.session_manager: SessionManager = self.app_injector.get(SessionManager)
        self._init_app_modules()

        Initialize the TaskWeaver app.
        :param app_dir: The project directory.
        :param use_local_uri: Whether to use local URI for artifacts.
        :param config: The configuration.
        :param kwargs: The additional arguments.
        
taskweaver/app/app.py