SessionView#
Restore model context and preserve immutable original messages. See the guide.
- class zett_agent.extensions.persistence.SessionView(*, parent_session_id=None, session_type, title=None, agent_name=None, snapshot=None, raw_tail=<factory>)[源代码]#
Latest checkpoint and the subsequent immutable Raw Log tail.
Persistence terminology:
+-----------------+------------------------------------------------------+ | Raw Log | Complete, immutable original conversation history. | +-----------------+------------------------------------------------------+ | Snapshot | One checkpoint replacing a compacted Raw Log prefix. | +-----------------+------------------------------------------------------+ | Session Context | Latest Snapshot plus the Raw Log tail after it. | +-----------------+------------------------------------------------------+
A Snapshot stores only one CompactedMessage. Recent messages remain solely in the Raw Log and are selected using the Snapshot boundary:
Raw Log [1] [2] [3] [4] [5] [6] [7] | [8] [9] [10] \______ compacted ______/ \__ tail__/ Snapshot [CompactedMessage through sequence 7] Session [CompactedMessage] [8] [9] [10] Context
No separate "last sequence" belongs to Session Context. Sequence numbers identify Raw Log records and the Snapshot boundary only.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- 参数:
parent_session_id (str | None)
session_type (int)
title (Annotated[str | None, MinLen(min_length=1), MaxLen(max_length=200)])
agent_name (Annotated[str | None, MinLen(min_length=1), MaxLen(max_length=64)])
snapshot (ContextSnapshot | None)
raw_tail (list[RawMessageRecord])
- property messages: list[AnyMessage]#
Build active model context as checkpoint followed by its Raw Log tail.
Fields#
parent_session_id(optional)Parent conversation for a delegated subagent; null for a root session
session_type(required)Storage-owned integer code describing the session origin
title(optional)Human-readable session title; applications may update it
agent_name(optional)Provider-neutral agent profile owning the session
snapshot(optional)Latest compacted checkpoint, if any
raw_tail(optional)Ordered Raw Log messages after the checkpoint boundary