Home /Modules/operating-system/SLServiceSet.sleela

SLServiceSet.sleela

lib/operating-system/SLServiceSet.sleela · 113 line(s) · sleela

<< lib/operating-system/SLServiceSet.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLServiceSet — the system-service layer of an OS being
     constructed: the set of services the init/service manager (systemd on Linux
     shapes, the Service Control Manager on Windows shapes, launchd on macOS
     shapes) brings up after the kernel hands off to user space. It records the
     name of the manager and the enabled services (device management,
     networking, logging, login/session, time sync), each marked as a boot-time
     or on-demand unit.
   
   In the firmware -> boot -> kernel -> userspace -> desktop model, this is the
   userspace-services node (PID 1 and the units it starts). The emitters turn
   the enabled set into the per-manager unit/registry artifacts the ISO carries.
   
   Family: operating-system. Pure design model; no native bridge calls. >>
#sleela 2.5
material;
class SLServiceSet {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10939;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < "systemd" / "ServiceControlManager" / "launchd" >
  String manager;
  < newline-separated "name mode" lines (mode: boot|ondemand) >
  String units;
  int count;
  int configured;

  void configure(String svcManager) {
    manager = svcManager; units = ""; count = 0; configured = 1;
  }

  void addUnit(String name, String mode) {
    String line = name + " " + mode;
    if (units == "") { units = line; } else { units = units + "\n" + line; }
    count = count + 1;
  }
  void enableAtBoot(String name) { addUnit(name, "boot"); }
  void enableOnDemand(String name) { addUnit(name, "ondemand"); }

  < Seed the baseline services a shape brings up, under its own manager. >
  void forShape(SLOSShape shape) {
    configure(shape.initManager());
    if (shape.isWindows()) {
      enableAtBoot("Winmgmt"); enableAtBoot("EventLog");
      enableAtBoot("Dnscache"); enableAtBoot("LanmanServer");
      enableAtBoot("Themes");
      return;
    }
    if (shape.isMac()) {
      enableAtBoot("com.apple.coreservicesd");
      enableAtBoot("com.apple.securityd");
      enableAtBoot("com.apple.networkd");
      enableAtBoot("com.apple.loginwindow");
      return;
    }
    < Linux: systemd units. >
    < device management >
    enableAtBoot("systemd-udevd");
    < networking >
    enableAtBoot("systemd-networkd");
    < logging >
    enableAtBoot("systemd-journald");
    < login/session >
    enableAtBoot("systemd-logind");
    < time sync >
    enableAtBoot("systemd-timesyncd");
  }

  String serviceManager() { return manager; }
  String unitManifest()   { return units; }
  int serviceCount()      { return count; }
  boolean hasServices()   { return count > 0; }
}