sessionservice

package
v0.28.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type SessionInfo

type SessionInfo struct {
	ID           string
	Name         string
	MessageCount int
	IsActive     bool
}

SessionInfo summarises a session for listing purposes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL