AntOS Library — os (reference)

The os library's design and native core. os is the one place AntOS most carefully honours the standard Lua/Luau contract — time and process functions are stock, and AntOS only adds. It is also the OS's control surface: scripts, the hardware clock, settings, DBFS volumes, and the shadow backup. The script-facing API is luau_os; the rule that governs it is antos_library_design §5.

What it is

Four bands:

  • Standard time/process — os.time/os.date/os.clock/os.difftime, the VM's own, untouched.
  • Restored host functions — os.remove/os.rename/os.getenv/os.tmpname/os.exit, re-introduced with reference signatures.
  • OS control — script running (run/spawn/exec/arguments), reset/hostname/version/notify/panic, and set_time.
  • Folded-in subsystems — the hardware clock (os.rtc.*, from the P4 rtc lib), settings (os.settings.*, from settings), DBFS volume management (os.dbfs.*), and shadow-backup control (os.shadow.*).

Design notes

  • The os.clock() deviation is fixed. The ESP32-P4 os.clock() returned monotonic wall-time; the rewrite restores the reference meaning (process CPU seconds), with the other clocks reachable via an optional os.clock(source) argument ("monotonic"/"uptime"/"wall") that portable code never passes. Monotonic time and uptime also have their canonical home on sys, along with os.heap_info/os.uptime — so os stops carrying system-introspection that pulled it away from standard.
  • The stock time functions are never reimplemented in the core — they come from the VM; a compat test guards it (antos_library_design §5).
  • os.rtc folds the MCP79410 driver in as a sub-namespace rather than a separate library, because it is the clock the OS reads; os.set_time writes both the system clock and the RTC, and the NTP half lives in net.
  • os.dbfs is a mount-level surface — switching the active volume remounts D: wholesale, above the per-file fs/db layer.
  • Settings is an extensible registry. The Settings window is a registry of pages, not a fixed list — libraries and scripts register their own tabs with os.settings.page, rendered as imgui draw callbacks alongside the system pages. A library ships its settings UI with itself, and the built-in pages use the identical mechanism, so there's no privileged "system settings" path.

Native cores

libantos_os (env/config store, drives, script metadata, DBFS-volume and shadow control, reset/hostname) plus the folded-in sys_rtc (MCP79410 over I²C) and sys_settings (config store). The binding marshals these and leaves the VM's time/process functions in place.

Related

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.