Class SessionTranscriptWriter

java.lang.Object
io.agentscope.harness.agent.memory.session.SessionTranscriptWriter

public class SessionTranscriptWriter extends Object
Independent writer for the session transcript JSONL (.jsonl / .log.jsonl).

Decoupled from MemoryFlushManager: transcript completeness must not depend on memory-flush triggers or prompts. Callers should invoke this at turn boundaries (see TranscriptMiddleware).

Tool calls and results are recorded as structured SessionEntry.ToolUseEntry / SessionEntry.ToolResultEntry rows so the call/result process is machine-readable. Content may still be truncated; truncated fields carry truncated + originalSize.

  • Field Details

    • INPUT_TRUNCATE_CHARS

      public static final int INPUT_TRUNCATE_CHARS
      Soft cap for tool input JSON in the transcript (process-complete; content may truncate).
      See Also:
    • OUTPUT_TRUNCATE_CHARS

      public static final int OUTPUT_TRUNCATE_CHARS
      Soft cap for tool output text in the transcript.
      See Also:
  • Constructor Details

  • Method Details

    • appendMessages

      public void appendMessages(io.agentscope.core.agent.RuntimeContext rc, List<io.agentscope.core.message.Msg> messages, String agentId, String sessionId)
      Appends new messages to the session tree idempotently (dedup by stable entry ids). Updates sessions.json index on success.
    • resolveContextPath

      public String resolveContextPath(io.agentscope.core.agent.RuntimeContext rc, String agentId, String sessionId)
      Resolves the workspace-relative path of the session context JSONL (for compaction summary references).