Interface TranscriptStore

All Known Implementing Classes:
FilesystemTranscriptStore, ObjectStoreTranscriptStore

public interface TranscriptStore
Narrow append-oriented store for session transcripts.

Orthogonal to BaseStore (document KV). Writes are immutable segments — never in-place append on a shared object — so concurrent writers cannot silently overwrite each other.

Key layout:


 {tenant}/{agentId}/{sessionId}/events/{seqStart}-{seqEnd}-{writerId}.jsonl
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Metadata for one immutable segment.
  • Method Summary

    Modifier and Type
    Method
    Description
    appendSegment(TranscriptRef ref, long seqStart, long seqEnd, String writerId, byte[] jsonl)
    Appends one immutable JSONL segment and returns its storage key.
    default void
    Optional compaction of small segments into a single object.
    void
    Deletes all segments for the transcript.
    Lists segments ordered by seqStart ascending.
    readSegment(String segmentKey)
    Opens a segment for reading; caller must close the stream.
    withRuntimeContext(io.agentscope.core.agent.RuntimeContext rc)
    Returns a store view bound to the given per-call RuntimeContext so that namespace-scoped backends (e.g., per-user local filesystems) route transcript segments into the caller's namespace instead of the un-namespaced root.
  • Method Details

    • appendSegment

      String appendSegment(TranscriptRef ref, long seqStart, long seqEnd, String writerId, byte[] jsonl)
      Appends one immutable JSONL segment and returns its storage key.
      Parameters:
      ref - transcript identity
      seqStart - inclusive start sequence (caller-assigned, contiguous preferred)
      seqEnd - inclusive end sequence
      writerId - unique writer / replica id (prevents key collisions)
      jsonl - UTF-8 JSONL payload (one SessionEntry per line)
      Returns:
      storage key of the written segment
    • listSegments

      Lists segments ordered by seqStart ascending.
    • readSegment

      InputStream readSegment(String segmentKey)
      Opens a segment for reading; caller must close the stream.
    • compact

      default void compact(TranscriptRef ref)
      Optional compaction of small segments into a single object.
    • withRuntimeContext

      default TranscriptStore withRuntimeContext(io.agentscope.core.agent.RuntimeContext rc)
      Returns a store view bound to the given per-call RuntimeContext so that namespace-scoped backends (e.g., per-user local filesystems) route transcript segments into the caller's namespace instead of the un-namespaced root.

      Stores whose location is fixed at construction time may ignore the context and return this.

    • delete

      void delete(TranscriptRef ref)
      Deletes all segments for the transcript.