Documentation
¶
Overview ¶
Package sessioncore owns the durable session lifecycle: sessions, messages and parts are written to the flat JSON storage and every change is published on the bus.
Index ¶
- Variables
- func GetUsage(input calc.GetUsageInput) calc.UsageResult
- func IsDefaultTitle(title string) bool
- type CreateInput
- type Info
- type Model
- type Options
- type Revert
- type Row
- type Service
- func (s *Service) Children(ctx context.Context, parentID string) ([]Info, error)
- func (s *Service) Create(ctx context.Context, input CreateInput) (Info, error)
- func (s *Service) Get(_ context.Context, sessionID string) (Info, error)
- func (s *Service) List(ctx context.Context) ([]Info, error)
- func (s *Service) Messages(ctx context.Context, sessionID string) ([]msgmodel.WithParts, error)
- func (s *Service) Remove(ctx context.Context, sessionID string) error
- func (s *Service) Touch(ctx context.Context, sessionID string) error
- func (s *Service) UpdateMessage(_ context.Context, info msgmodel.Info) error
- func (s *Service) UpdateMessageWithParts(_ context.Context, info msgmodel.Info, parts ...msgmodel.Part) error
- func (s *Service) UpdatePart(_ context.Context, part msgmodel.Part) error
- func (s *Service) UpdatePartDelta(_ context.Context, input msgmodel.PartDeltaEvent)
- type Share
- type Summary
- type Time
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EventCreated = bus.Define("session.created", nil) EventUpdated = bus.Define("session.updated", nil) EventDeleted = bus.Define("session.deleted", nil) EventDiff = bus.Define("session.diff", nil) EventError = bus.Define("session.error", nil) EventMessageUpdated = bus.Define(msgmodel.EventMessageUpdated, nil) EventMessageRemoved = bus.Define(msgmodel.EventMessageRemoved, nil) EventMessagePartUpdated = bus.Define(msgmodel.EventMessagePartUpdated, nil) EventMessagePartDelta = bus.Define(msgmodel.EventMessagePartDelta, nil) EventMessagePartRemoved = bus.Define(msgmodel.EventMessagePartRemoved, nil) )
Functions ¶
func GetUsage ¶
func GetUsage(input calc.GetUsageInput) calc.UsageResult
func IsDefaultTitle ¶
Types ¶
type CreateInput ¶
type Info ¶
type Info struct {
ID string `json:"id"`
Slug string `json:"slug"`
ProjectID string `json:"projectID"`
WorkspaceID *string `json:"workspaceID,omitempty"`
Directory string `json:"directory"`
Path *string `json:"path,omitempty"`
ParentID *string `json:"parentID,omitempty"`
Title string `json:"title"`
Agent *string `json:"agent,omitempty"`
Model *Model `json:"model,omitempty"`
Version string `json:"version"`
Summary *Summary `json:"summary,omitempty"`
Revert *Revert `json:"revert,omitempty"`
Permission json.RawMessage `json:"permission,omitempty"`
Time Time `json:"time"`
}
Info is the durable session record.
type Row ¶
type Row struct {
ID string `json:"id"`
ProjectID string `json:"project_id"`
WorkspaceID *string `json:"workspace_id,omitempty"`
ParentID *string `json:"parent_id,omitempty"`
Slug string `json:"slug"`
Directory string `json:"directory"`
Path *string `json:"path,omitempty"`
Title string `json:"title"`
Agent *string `json:"agent,omitempty"`
Model *Model `json:"model,omitempty"`
Version string `json:"version"`
SummaryAdditions *uint64 `json:"summary_additions,omitempty"`
SummaryDeletions *uint64 `json:"summary_deletions,omitempty"`
SummaryFiles *uint64 `json:"summary_files,omitempty"`
SummaryDiffs []msgmodel.FileDiff `json:"summary_diffs,omitempty"`
Revert *Revert `json:"revert"`
Permission json.RawMessage `json:"permission,omitempty"`
TimeCreated uint64 `json:"time_created"`
TimeUpdated uint64 `json:"time_updated"`
TimeCompacting *uint64 `json:"time_compacting,omitempty"`
TimeArchived *float64 `json:"time_archived,omitempty"`
}
Row is the storage-row projection consumed by FromRow and produced by ToRow.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is safe for concurrent processor and observer use.
func (*Service) Messages ¶
Messages returns the session's messages oldest-first, each with its parts.
func (*Service) UpdateMessage ¶
func (*Service) UpdateMessageWithParts ¶
func (s *Service) UpdateMessageWithParts( _ context.Context, info msgmodel.Info, parts ...msgmodel.Part, ) error
UpdateMessageWithParts makes the message visible only after all of its parts are durable. The files are written part-first under one store operation, then projected message-first so SQLite foreign keys observe a complete turn.
func (*Service) UpdatePart ¶
func (*Service) UpdatePartDelta ¶
func (s *Service) UpdatePartDelta(_ context.Context, input msgmodel.PartDeltaEvent)
Click to show internal directories.
Click to hide internal directories.