onboarding_facts.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. """The safe facts (class A) a first-run onboarding is built from, read once when the run starts.
  2. No consent is needed for any of them: OS, architecture, machine kind, the NVIDIA platform, the
  3. locale, which onboarding plugins this OS runs, and whether tours are on. They describe the machine
  4. running this backend; the desktop says when that is not the user's own computer (``facts_source``).
  5. """
  6. from __future__ import annotations
  7. from agent.onboarding_flow import Facts
  8. _OS = {"darwin": "macos", "win32": "windows"}
  9. def read_facts(*, facts_source: str = "local", locale: str | None = None) -> Facts:
  10. """``locale``: the desktop's UI language, preferred over the backend OS locale for wording."""
  11. from hermes_cli.plugin_catalog_presence import onboarding_names
  12. from hermes_platform.host.summary import summary
  13. from tools.tour_tool import check_tours_enabled
  14. host = summary()
  15. machine = host["machine"]
  16. return Facts(
  17. os=_OS.get(machine.get("os_family", ""), "linux"), arch=machine.get("native_arch", ""),
  18. machine_kind=host["machine_kind"], nvidia_platform=host["nvidia_platform"],
  19. facts_source="remote" if facts_source == "remote" else "local", locale=locale or host["locale"],
  20. plugins=tuple(onboarding_names()), tours=check_tours_enabled())
  21. def suggested_name() -> str | None:
  22. """The OS account's real name for the name card. It goes to the card only: the model sees it
  23. when the user picks it."""
  24. from hermes_platform.host.summary import summary
  25. return summary()["full_name"]