SLMoralVerdict.sleela
lib/moral-capacitor/SLMoralVerdict.sleela · 101 line(s) · sleela
<< lib/moral-capacitor/SLMoralVerdict.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLMoralVerdict — the decision a Moral Capacitor(TM)
returns for an operation. A verdict is PERMIT (charge met the threshold and
no veto tripped), DEFER (partial charge: hold and request more justification
or consent), or DENY (no charge, or a veto tripped). The verdict carries the
stored charge, the threshold it was compared against, the deciding
framework or red line, and a human-readable reason, so a caller can log
exactly why an operation was allowed, held, or refused.
Family: moral-capacitor. Returned by SLMoralCapacitor.evaluate. >>
#sleela 2.5
material;
class SLMoralVerdict {
< ---- 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 = 10918;
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; }
< Decision ordinals. >
static final int PERMIT = 1;
static final int DEFER = 2;
static final int DENY = 3;
< PERMIT / DEFER / DENY >
int decision;
< stored moral charge at decision time >
int charge;
< the threshold compared against >
int threshold;
< deciding framework or tripped red line >
String basis;
< human-readable explanation >
String reason;
int configured;
void configure(int d, int chargeLevel, int thresh, String decidingBasis, String why) {
decision = d; charge = chargeLevel; threshold = thresh;
basis = decidingBasis; reason = why; configured = 1;
}
boolean permitted() { return decision == PERMIT; }
boolean deferred() { return decision == DEFER; }
boolean denied() { return decision == DENY; }
int decisionCode() { return decision; }
int chargeLevel() { return charge; }
int thresholdLevel(){ return threshold; }
String decidingBasis() { return basis; }
String explanation() { return reason; }
String decisionName() {
if (decision == PERMIT) { return "PERMIT"; }
if (decision == DEFER) { return "DEFER"; }
return "DENY";
}
< A one-line summary for logs/ledger. >
String summary() {
return decisionName() + " (charge " + intToStr(charge) + "/" + intToStr(threshold)
+ "; " + basis + "): " + reason;
}
String intToStr(int v) { return "" + v; }
}