Class ContextSnapshot

java.lang.Object
io.agentscope.extensions.aistio.model.ContextSnapshot

public final class ContextSnapshot extends Object
Level-4 effective-context snapshot: what the agent's next model call will actually see.

Carries both encodings — toProto() for the ASDP ContextReport upstream push, and toJsonMap() for GET /agentscope/sessions/{id}/context.

computeHash() produces the same digest as the Go control plane and the Python SDK: SHA-256 over recursively key-sorted, separator-free JSON of the effective content, truncated to HASH_LEN hex characters. The control plane compares hashes to detect context drift without fetching the body.

  • Field Details

    • HASH_LEN

      public static final int HASH_LEN
      Number of leading hex characters of the SHA-256 digest kept as the context hash.
      See Also:
  • Method Details

    • builder

      public static ContextSnapshot.Builder builder(String sessionId)
    • getSessionId

      public String getSessionId()
    • getSystemPrompt

      public String getSystemPrompt()
    • getMessages

      public List<ContextSnapshot.ContextMessage> getMessages()
    • getTools

      public List<ContextSnapshot.ToolInfo> getTools()
    • isCompacted

      public boolean isCompacted()
    • getCompactionSummary

      public String getCompactionSummary()
    • getOriginalMessageCount

      public int getOriginalMessageCount()
    • getCompactedAt

      public long getCompactedAt()
    • getFramework

      public String getFramework()
    • getModel

      public String getModel()
    • getFrameworkState

      public byte[] getFrameworkState()
    • getCapturedAt

      public long getCapturedAt()
    • getTotalTokens

      public int getTotalTokens()
    • getMaxTokens

      public int getMaxTokens()
    • getContextHash

      public String getContextHash()
    • refreshHash

      public String refreshHash()
      Recomputes and stores getContextHash(), returning the new value.
    • computeHash

      public String computeHash()
    • toProto

      public ContextReport toProto()
    • toJsonMap

      public Map<String,Object> toJsonMap()
      Response body for GET /agentscope/sessions/{id}/context.