Documentation
¶
Index ¶
- Constants
- type HistoryRepo
- type Option
- type Service
- func (s *Service) CopyLatestHistoryToSession(ctx context.Context, ticketID types.TicketID, sessionID types.SessionID) (bool, error)
- func (s *Service) GetLatestHistory(ctx context.Context, ticketID types.TicketID) (*gollem.History, error)
- func (s *Service) GetSessionHistory(ctx context.Context, sessionID types.SessionID) (*gollem.History, error)
- func (s *Service) HasSessionHistory(ctx context.Context, sessionID types.SessionID) bool
- func (s *Service) PutLatestHistory(ctx context.Context, ticketID types.TicketID, history *gollem.History) error
- func (s *Service) PutSessionHistory(ctx context.Context, sessionID types.SessionID, history *gollem.History) error
Constants ¶
const (
StorageSchemaVersion = "v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HistoryRepo ¶ added in v0.12.0
type HistoryRepo struct {
// contains filtered or unexported fields
}
HistoryRepo implements gollem.HistoryRepository using the storage service. It persists the latest history snapshot for a ticket, keyed by ticket ID. Save errors are handled via errutil but not returned to avoid interrupting agent execution.
func NewHistoryRepo ¶ added in v0.12.0
func NewHistoryRepo(svc *Service, ticketID types.TicketID) *HistoryRepo
NewHistoryRepo creates a new HistoryRepo for the given ticket.
func NewHistoryRepoFromContext ¶ added in v0.12.0
func NewHistoryRepoFromContext(_ context.Context, svc *Service, ticketID types.TicketID) *HistoryRepo
NewHistoryRepoFromContext creates a new HistoryRepo for the given ticket.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(storageClient interfaces.StorageClient, opts ...Option) *Service
func (*Service) CopyLatestHistoryToSession ¶ added in v0.16.0
func (s *Service) CopyLatestHistoryToSession(ctx context.Context, ticketID types.TicketID, sessionID types.SessionID) (bool, error)
CopyLatestHistoryToSession performs a server-side copy from the legacy ticket-scoped latest.json path into the Session-scoped history.json path. The payload never transits the caller's process — GCS executes the rewrite internally. Returns (copied=false, nil) when the legacy file does not exist, so the migration job can count the Session as a skip instead of an error.
func (*Service) GetLatestHistory ¶ added in v0.12.0
func (s *Service) GetLatestHistory(ctx context.Context, ticketID types.TicketID) (*gollem.History, error)
GetLatestHistory retrieves the latest history snapshot for the given ticket. Returns nil History and nil error if the storage client is not configured.
func (*Service) GetSessionHistory ¶ added in v0.16.0
func (s *Service) GetSessionHistory(ctx context.Context, sessionID types.SessionID) (*gollem.History, error)
GetSessionHistory loads the gollem.History for a Session. Returns (nil, nil) when no history has been saved yet so callers can start fresh without special-casing.
func (*Service) HasSessionHistory ¶ added in v0.16.0
HasSessionHistory reports whether a Session-scoped history object has already been persisted. Uses a cheap GetObject probe because the StorageClient interface does not expose attribute lookups; callers should treat read errors ("object not found", etc.) as "no history yet" rather than a hard failure.
func (*Service) PutLatestHistory ¶ added in v0.12.0
func (s *Service) PutLatestHistory(ctx context.Context, ticketID types.TicketID, history *gollem.History) error
PutLatestHistory saves the history as the latest snapshot for the given ticket. The object at latest.json is overwritten on each call.
func (*Service) PutSessionHistory ¶ added in v0.16.0
func (s *Service) PutSessionHistory(ctx context.Context, sessionID types.SessionID, history *gollem.History) error
PutSessionHistory saves the gollem.History for a Session. The object is overwritten on each call (we only keep the most recent state; older turns' state is reconstructed from Messages if needed).