Record Class SandboxExecutionEvent

java.lang.Object
java.lang.Record
com.tnsai.quality.sandbox.SandboxExecutionEvent
Record Components:
eventId - unique id, helpful for log correlation
timestamp - when the execution started
sandboxId - stable id of the sandbox (factory id + instance counter); same instance reused across executes carries the same id
backend - sandbox backend that ran the command (e.g. "process", "container")
image - image / runtime identifier from SandboxSpec.image(); empty for backends that don't use images
argv - executed argv
exitCode - from SandboxResult
timedOut - from SandboxResult
resourceUsage - from SandboxResult
networkPolicy - class name of the policy that was in effect ("DenyAll", "Inherit", "AllowList") — string so consumers don't have to depend on the sealed-interface hierarchy

public record SandboxExecutionEvent(String eventId, Instant timestamp, String sandboxId, String backend, String image, List<String> argv, int exitCode, boolean timedOut, ResourceUsage resourceUsage, String networkPolicy) extends Record
Per-execute observability event for the sandbox layer (TNS-296). Emitted to a SandboxExecutionListener when one is wired onto a Sandbox; carries enough information for downstream audit / metrics / billing pipelines to attribute resource cost back to the policy that authorised it.

Pairs with TnsAI accountability (TNS-298): the correlationId the sandbox event carries can be the same id stamped on the AgentLiabilityRecord that triggered the dispatch — a single audit timeline for "agent X attempted action Y inside sandbox Z".

Since:
0.10.0 (TNS-296)
  • Constructor Details

    • SandboxExecutionEvent

      public SandboxExecutionEvent(String eventId, Instant timestamp, String sandboxId, String backend, String image, List<String> argv, int exitCode, boolean timedOut, ResourceUsage resourceUsage, String networkPolicy)
      Creates an instance of a SandboxExecutionEvent record class.
      Parameters:
      eventId - the value for the eventId record component
      timestamp - the value for the timestamp record component
      sandboxId - the value for the sandboxId record component
      backend - the value for the backend record component
      image - the value for the image record component
      argv - the value for the argv record component
      exitCode - the value for the exitCode record component
      timedOut - the value for the timedOut record component
      resourceUsage - the value for the resourceUsage record component
      networkPolicy - the value for the networkPolicy record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • eventId

      public String eventId()
      Returns the value of the eventId record component.
      Returns:
      the value of the eventId record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • sandboxId

      public String sandboxId()
      Returns the value of the sandboxId record component.
      Returns:
      the value of the sandboxId record component
    • backend

      public String backend()
      Returns the value of the backend record component.
      Returns:
      the value of the backend record component
    • image

      public String image()
      Returns the value of the image record component.
      Returns:
      the value of the image record component
    • argv

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

      public int exitCode()
      Returns the value of the exitCode record component.
      Returns:
      the value of the exitCode record component
    • timedOut

      public boolean timedOut()
      Returns the value of the timedOut record component.
      Returns:
      the value of the timedOut record component
    • resourceUsage

      public ResourceUsage resourceUsage()
      Returns the value of the resourceUsage record component.
      Returns:
      the value of the resourceUsage record component
    • networkPolicy

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