Documentation
¶
Overview ¶
Package sessionservice stores CLI chat sessions so conversations persist across terminal restarts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service interface {
// New creates a new named session and makes it active.
// If name is empty, a UUID-based name is generated.
New(ctx context.Context, identity, name string) (id string, err error)
// List returns all sessions for the given identity with message counts.
// The currently active session is marked IsActive = true.
List(ctx context.Context, identity string) ([]*SessionInfo, error)
// Switch changes the active session pointer to the session with the given name.
Switch(ctx context.Context, identity, name string) error
// Delete removes a session and its messages. Reports whether the session
// that was deleted was the currently active one.
Delete(ctx context.Context, identity, name string) (wasActive bool, err error)
// GetActiveID reads the active session ID from the KV store.
// Returns ("", nil) when no session is active.
GetActiveID(ctx context.Context) (string, error)
// SetActiveID persists an active session ID to the KV store.
SetActiveID(ctx context.Context, id string) error
// EnsureDefault creates (or reuses) a "default" session, sets it active,
// and returns its ID. Idempotent.
EnsureDefault(ctx context.Context, identity string) (string, error)
}
Service is the session management interface.
func New ¶
func New(db libdb.DBManager, workspaceID string, tracker libtracker.ActivityTracker) Service
Click to show internal directories.
Click to hide internal directories.