<< lib/moral-capacitor/SLOSMoralGate.sleela SLeeLa Standard Library Definition. Definition: Defines SLOSMoralGate — the Moral Capacitor(TM) adapter for the OS surface (SLOperatingSystem, the OS Creator(TM) provider, and the installers). It wraps an SLMoralCapacitor with OS-appropriate policies and exposes intention-named checks the OS consults before a consequential step: running a shell command, deleting or formatting a filesystem path, installing to a disk, and writing an OS development tree. Destructive operations use a strict, consent-requiring, fail-closed policy. The gate makes the OS's most dangerous actions — the ones that erase data or execute arbitrary commands — require an explicit, auditable moral discharge before they run. Family: moral-capacitor. OS adapter over SLMoralCapacitor. >> #sleela 2.5 material; class SLOSMoralGate { < ---- 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 = 10931; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | 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; } SLMoralCapacitor cap; SLMoralLedger ledger; < the OS product's Certificate of Morals > SLMoralCertificate certificate; < admits the OS only when certified > SLMoralCodeGuard codeGuard; int configured; void configure() { cap = new SLMoralCapacitor(); cap.configure(); ledger = new SLMoralLedger(); ledger.configure(); certificate = null; codeGuard = null; configured = 1; } < Certify this OS: issue a Certificate of Morals over the gate's capacitor and > < arm a code guard against it, so the OS is a morally certified product. > void certify(SLMoralCertificateAuthority authority, int redlinesArmed, String issuedAt, String expiresAt) { certificate = authority.issue("sleela-os", cap, redlinesArmed, issuedAt, expiresAt); codeGuard = new SLMoralCodeGuard(); codeGuard.configure(authority); } < Prove at the OS product boundary (ship/boot/install) that the moral code is > < present and certified as of nowStamp. > boolean admit(String nowStamp) { if (codeGuard == null || certificate == null) { return false; } return codeGuard.permits("sleela-os", cap, certificate, nowStamp); } SLMoralCertificate moralCertificate() { return certificate; } < Reading identity/env/cwd is routine and reversible. > SLMoralVerdict permitQuery(String what) { SLMoralPolicy p = new SLMoralPolicy(); p.osRoutine(); return decide(op("os", "query", what, "host", true, true), p); } < Running a shell command reaches the host: a higher bar, consent assumed > < from the caller but screened for red lines. > SLMoralVerdict permitRun(String command, boolean consented) { SLMoralPolicy p = new SLMoralPolicy(); p.osRoutine(); p.setThreshold(4); return decide(op("os", "run", command, "host", true, consented), p); } < Deleting a path is irreversible: strict policy, consent required. > SLMoralVerdict permitErase(String path, boolean consented) { SLMoralPolicy p = new SLMoralPolicy(); p.osDestructive(); return decide(op("os", "erase", path, "disk", false, consented), p); } < Formatting / installing to a disk is the most destructive OS action. > SLMoralVerdict permitInstallToDisk(String device, boolean consented) { SLMoralPolicy p = new SLMoralPolicy(); p.osDestructive(); return decide(op("os", "format", device, "disk", false, consented), p); } < OS Creator(TM) writing a development tree is reversible (an output dir). > SLMoralVerdict permitWriteDevTree(String root) { SLMoralPolicy p = new SLMoralPolicy(); p.osRoutine(); return decide(op("os", "write", root, "disk", true, true), p); } SLMoralLedger auditLedger() { return ledger; } SLMoralCapacitor capacitor() { return cap; } SLMoralOperation op(String actor, String action, String target, String scope, boolean reversible, boolean consented) { SLMoralOperation o = new SLMoralOperation(); o.configure(actor, action, target, scope); o.setReversible(reversible); o.setConsented(consented); return o; } SLMoralVerdict decide(SLMoralOperation o, SLMoralPolicy p) { cap.discharge(); cap.setPolicy(p); SLMoralVerdict v = cap.gate(o); ledger.record(o, v); return v; } }