Package com.tnsai.accountability
Record Class ReputationScore
java.lang.Object
java.lang.Record
com.tnsai.accountability.ReputationScore
- Record Components:
agentId- identity the score belongs toscore- normalised aggregate,[0.0, 1.0]recordCount- how many records the score was computed fromcomputedAt- wall-clock instant of computation; useful for cache-staleness checks downstream
public record ReputationScore(String agentId, double score, int recordCount, Instant computedAt)
extends Record
Aggregate reputation derived from an agent's
AgentLiabilityRecord history (TNS-298).
Score is normalised to [0.0, 1.0] where 1.0 means
"every recorded action stayed within scope and produced a successful
outcome" and 0.0 means "every recorded action either
exceeded scope or failed". The mid-band reflects partial success;
the ReputationLedger implementation defines how it weighs
LiabilityClass severity (one HIGH miss outweighs many LOW
misses by convention, but ledgers can use other policies).
- Since:
- 0.10.0 (TNS-298)
-
Constructor Summary
ConstructorsConstructorDescriptionReputationScore(String agentId, double score, int recordCount, Instant computedAt) Creates an instance of aReputationScorerecord class. -
Method Summary
Modifier and TypeMethodDescriptionagentId()Returns the value of theagentIdrecord component.Returns the value of thecomputedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of therecordCountrecord component.doublescore()Returns the value of thescorerecord component.final StringtoString()Returns a string representation of this record class.static ReputationScoreScore for an agent with no recorded history.
-
Constructor Details
-
ReputationScore
Creates an instance of aReputationScorerecord class.- Parameters:
agentId- the value for theagentIdrecord componentscore- the value for thescorerecord componentrecordCount- the value for therecordCountrecord componentcomputedAt- the value for thecomputedAtrecord component
-
-
Method Details
-
unknown
Score for an agent with no recorded history. Convention is1.0— innocent until proven otherwise — so a fresh agent doesn't fail "minimum reputation" gates on its first call. Operators who want stricter onboarding return a lower score for unknown agents in their custom ledger. -
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. -
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. -
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
score
public double score()Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-
recordCount
public int recordCount()Returns the value of therecordCountrecord component.- Returns:
- the value of the
recordCountrecord component
-
computedAt
Returns the value of thecomputedAtrecord component.- Returns:
- the value of the
computedAtrecord component
-