Record Class ExportedRole

java.lang.Object
java.lang.Record
com.tnsai.roles.export.ExportedRole
Record Components:
identity - role identity (name, goal, domain)
autoResponsibilities - responsibilities auto-extracted from @ActionSpec methods
actions - list of action metadata
states - list of state extracted from @State fields
intentions - list of intentions extracted from @ActionSpec methods
llmSpec - LLM configuration if present
annotations - additional annotation data
className - fully qualified class name
version - role version

public record ExportedRole(RoleIdentity identity, List<RoleSpecExtractor.ResponsibilityInfo> autoResponsibilities, List<ActionMetadata> actions, List<RoleSpecExtractor.StateInfo> states, List<String> intentions, RoleSpecExtractor.LLMExportSpec llmSpec, Map<String,Object> annotations, String className, String version) extends Record
Immutable data class representing exported role metadata.

As of 0.9.0, the role-level Responsibility bag is gone. Per-action constraints (mustNever / mustAlways) are carried by RoleSpecExtractor.ResponsibilityInfo entries returned via autoResponsibilities().

Author:
TnsAI Team
  • Constructor Details

  • Method Details

    • from

      public static ExportedRole from(Role role)
    • fromClass

      public static ExportedRole fromClass(Class<? extends Role> roleClass)
    • hasLLMSpec

      public boolean hasLLMSpec()
    • hasActions

      public boolean hasActions()
    • hasState

      public boolean hasState()
    • hasIntentions

      public boolean hasIntentions()
    • hasAutoResponsibilities

      public boolean hasAutoResponsibilities()
      Checks if this role has any auto-extracted responsibilities from @ActionSpec methods (descriptions, invariants, mustNever/mustAlways).
    • getName

      public String getName()
    • getGoal

      public String getGoal()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • identity

      public RoleIdentity identity()
      Returns the value of the identity record component.
      Returns:
      the value of the identity record component
    • autoResponsibilities

      public List<RoleSpecExtractor.ResponsibilityInfo> autoResponsibilities()
      Returns the value of the autoResponsibilities record component.
      Returns:
      the value of the autoResponsibilities record component
    • actions

      public List<ActionMetadata> actions()
      Returns the value of the actions record component.
      Returns:
      the value of the actions record component
    • states

      Returns the value of the states record component.
      Returns:
      the value of the states record component
    • intentions

      public List<String> intentions()
      Returns the value of the intentions record component.
      Returns:
      the value of the intentions record component
    • llmSpec

      Returns the value of the llmSpec record component.
      Returns:
      the value of the llmSpec record component
    • annotations

      public Map<String,Object> annotations()
      Returns the value of the annotations record component.
      Returns:
      the value of the annotations record component
    • className

      public String className()
      Returns the value of the className record component.
      Returns:
      the value of the className record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component