TranscriptStore
public interface TranscriptStore
io/agentscope/harness/agent/transcript/TranscriptStore.java:35–78定义 Transcript 存储契约的接口。位于 io.agentscope.harness.agent.transcript 包。核心成员包括 appendSegment、listSegments、readSegment、compact、withRuntimeContext、delete。
Narrow append-oriented store for session transcripts.
Orthogonal to io.agentscope.harness.agent.filesystem.remote.store.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
| 类Class | 类型Kind | 说明Description |
|---|---|---|
SegmentInfo | 记录record | 承载 Segment 信息数据的记录类型。 Metadata for one immutable segment. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String appendSegment(TranscriptRef ref, long seqStart, long seqEnd, String writerId, byte[] jsonl) | 追加 `appendSegment`。 Appends one immutable JSONL segment and returns its storage key. |
public List<SegmentInfo> listSegments(TranscriptRef ref) | 列出 `listSegments`。 Lists segments ordered by `seqStart` ascending. |
public InputStream readSegment(String segmentKey) | 设置该参数。 Opens a segment for reading; caller must close the stream. |
default public void compact(TranscriptRef ref)default | 设置该参数。 Optional compaction of small segments into a single object. |
default public TranscriptStore withRuntimeContext(RuntimeContext rc)default | 执行使用运行时上下文相关操作。 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. |
public void delete(TranscriptRef ref) | 删除数据。 Deletes all segments for the transcript. |
方法详情Method Detail
appendSegment
public String appendSegment(TranscriptRef ref, long seqStart, long seqEnd, String writerId, byte[] jsonl)
追加 appendSegment。
Appends one immutable JSONL segment and returns its storage key.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ref | TranscriptRef | 引用(类型 `TranscriptRef`)。transcript identity |
seqStart | long | seq 启动(类型 `long`)。inclusive start sequence (caller-assigned, contiguous preferred) |
seqEnd | long | seq 结束(类型 `long`)。inclusive end sequence |
writerId | String | writer 标识(类型 `String`)。unique writer / replica id (prevents key collisions) |
jsonl | byte[] | jsonl(类型 `byte[]`)。UTF-8 JSONL payload (one `io.agentscope.harness.agent.memory.session.SessionEntry` per line) |
Stringio/agentscope/harness/agent/transcript/TranscriptStore.java:48–49listSegments
public List<SegmentInfo> listSegments(TranscriptRef ref)
列出 listSegments。
Lists segments ordered by seqStart ascending.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ref | TranscriptRef | 引用(类型 `TranscriptRef`)。The ref. |
List<SegmentInfo>io/agentscope/harness/agent/transcript/TranscriptStore.java:52readSegment
public InputStream readSegment(String segmentKey)
设置该参数。
Opens a segment for reading; caller must close the stream.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
segmentKey | String | segment 键(类型 `String`)。The segment key. |
InputStreamio/agentscope/harness/agent/transcript/TranscriptStore.java:55compact
default public void compact(TranscriptRef ref)
设置该参数。
Optional compaction of small segments into a single object.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ref | TranscriptRef | 引用(类型 `TranscriptRef`)。The ref. |
io/agentscope/harness/agent/transcript/TranscriptStore.java:58withRuntimeContext
default public TranscriptStore withRuntimeContext(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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
TranscriptStoreio/agentscope/harness/agent/transcript/TranscriptStore.java:68–70delete
public void delete(TranscriptRef ref)
删除数据。
Deletes all segments for the transcript.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ref | TranscriptRef | 引用(类型 `TranscriptRef`)。The ref. |
io/agentscope/harness/agent/transcript/TranscriptStore.java:73嵌套类详情Nested Class Detail
SegmentInfo
record SegmentInfo( String key, long seqStart, long seqEnd, String writerId, Instant createdAt)承载 Segment 信息数据的记录类型。位于 io.agentscope.harness.agent.transcript 包。核心成员包括 key、seqStart、seqEnd、writerId、createdAt。
Metadata for one immutable segment.