code: def main(cfg: DictConfig) -> None:
      db, cfg = load_db_and_process_config(cfg)
  
      world_opt = {
          "num_turns": cfg.num_turns,
          "turn_timeout": cfg.turn_timeout,
      }
  
      custom_bundle_path = cfg.mephisto.blueprint.get(
          "custom_source_bundle", None
      )
      if custom_bundle_path is not None:
          assert os.path.exists(custom_bundle_path), (
              "Must build the custom bundle with `npm install; npm run dev` from within "
              f"the {TASK_DIRECTORY}/webapp directory in order to demo a custom bundle "
          )
          world_opt["send_task_data"] = True
  
      shared_state = SharedParlAITaskState(
          world_opt=world_opt, onboarding_world_opt=world_opt
      )
  
      operator = Operator(db)
  
      operator.validate_and_run_config(cfg.mephisto, shared_state)
      operator.wait_for_runs_then_shutdown(
          skip_input=True, log_rate=cfg.monitoring_log_rate
      )
  
file_path: ParlAI/parlai/crowdsourcing/tasks/chat_demo/run.py
imports: import os
  from dataclasses import dataclass, field
  import hydra
  from omegaconf import DictConfig, MISSING
  from examples.parlai_chat_task_demo.parlai_test_script import TestScriptConfig, TASK_DIRECTORY
  from mephisto.operations.hydra_config import register_script_config
  from mephisto.operations.operator import Operator
  from mephisto.abstractions.blueprints.parlai_chat.parlai_chat_blueprint import SharedParlAITaskState
  from mephisto.tools.scripts import load_db_and_process_config
  from parlai.crowdsourcing.utils.mturk import MTurkRunScriptConfigMixin
label_desc: Use image node_id 1 for calling a global function with example usage: main(cfg) without return types