File size: 692 Bytes
aa15bce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from __future__ import annotations

from dataclasses import dataclass, field
from datetime import datetime
from typing import List, Optional


@dataclass(frozen=True)
class LogEntry:
    """Snapshot of a single conversation log entry."""

    tag: str
    payload: str
    index: int = -1
    timestamp: Optional[str] = None


@dataclass
class SummaryState:
    """Persisted working-memory summary state."""

    summary_text: str = ""
    last_index: int = -1
    updated_at: Optional[datetime] = None
    unsummarized_entries: List[LogEntry] = field(default_factory=list)

    @classmethod
    def empty(cls) -> "SummaryState":
        return cls()


__all__ = ["LogEntry", "SummaryState"]