Home /Modules/large-language-models/SLLlmCodeModel.sleela

SLLlmCodeModel.sleela

lib/large-language-models/SLLlmCodeModel.sleela · 138 line(s) · sleela

<< lib/large-language-models/SLLlmCodeModel.sleela
   SLeeLa Standard Library Definition.
   Definition: SLeeLa mirror of the Code LLM profile (sllmcx_ in
   large_language_models_code.h). Declares a user-owned procedural code model and
   the contract by which its proposals (summaries, dry-run state, refactorings)
   are verified by a caller-supplied compiler/test/tracer. It composes with the
   capacity profile and the reasoning layer's CODE subject. >>
#sleela 3.0
material;
class SLLlmCodeModel {
  < ---- 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 = 8208;
  String metaAuthor = "Max Rupplin";
  String metaDate = "2026-11-06";
  String metaCopyright = "MEARVK LLC";
  String metaTrademark = "none";
  String metaCorporation = "MEARVK LLC";
  String metaOrigin = "International";
  String metaBirthDate = "2026-11-06";
  int metaScienceRating = 6;
  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; }

  < sllmcx_language mirror. >
  static final int LANG_C = 0;
  static final int LANG_FORTRAN = 1;
  static final int LANG_PASCAL = 2;
  static final int LANG_PYTHON = 3;
  static final int LANG_SHELL = 4;
  static final int LANG_SLEELA = 5;
  static final int LANG_OTHER = 6;

  < sllmcx_task bit flags. >
  static final int TASK_SUMMARIZE = 1;
  static final int TASK_DRY_RUN = 2;
  static final int TASK_REFACTOR = 4;
  static final int TASK_TRANSLATE = 8;
  static final int TASK_DEBUG = 16;
  static final int TASK_COMPLETE = 32;

  < sllmcx_check_mode mirror: strength of verification. NONE keeps claims UNKNOWN. >
  static final int CHECK_NONE = 0;
  static final int CHECK_COMPILE = 1;
  static final int CHECK_TEST = 2;
  static final int CHECK_TRACE = 3;

  < sllmcx_status mirror. >
  static final int STATUS_OK = 0;
  static final int STATUS_INVALID_ARGUMENT = 1;
  static final int STATUS_UNSUPPORTED = 2;

  < sllmcx_profile fields. >
  String modelId;
  String baseFamily;
  int primaryLanguage;
  String otherLanguage;
  int tasks;
  int checkMode;
  boolean fillInMiddle;

  < sllmcx_profile_init: C + summarize+dry-run+refactor+translate + trace + FIM off. >
  void initProfile() {
    modelId = null;
    baseFamily = "code-language-model";
    primaryLanguage = LANG_C;
    otherLanguage = null;
    tasks = TASK_SUMMARIZE + TASK_DRY_RUN + TASK_REFACTOR + TASK_TRANSLATE;
    checkMode = CHECK_TRACE;
    fillInMiddle = false;
  }

  < sllmcx_profile_has_task: bitwise membership test. >
  boolean hasTask(int task) {
    return (tasks / task) - ((tasks / task) / 2) * 2 == 1 && tasks >= task;
  }

  String languageName(int lang) {
    if (lang == LANG_C) { return "c"; }
    if (lang == LANG_FORTRAN) { return "fortran"; }
    if (lang == LANG_PASCAL) { return "pascal"; }
    if (lang == LANG_PYTHON) { return "python"; }
    if (lang == LANG_SHELL) { return "shell"; }
    if (lang == LANG_SLEELA) { return "sleela"; }
    if (lang == LANG_OTHER) { return "other"; }
    return "unknown";
  }

  String languageLabel() {
    if (primaryLanguage == LANG_OTHER && otherLanguage != null) {
      return otherLanguage;
    }
    return languageName(primaryLanguage);
  }

  String checkModeName(int mode) {
    if (mode == CHECK_NONE) { return "none"; }
    if (mode == CHECK_COMPILE) { return "compile"; }
    if (mode == CHECK_TEST) { return "test"; }
    if (mode == CHECK_TRACE) { return "trace"; }
    return "unknown";
  }

  String statusString(int status) {
    if (status == STATUS_OK) { return "ok"; }
    if (status == STATUS_INVALID_ARGUMENT) { return "invalid argument"; }
    if (status == STATUS_UNSUPPORTED) { return "unsupported"; }
    return "unknown";
  }

  boolean available() { return baseFamily != null; }
}