sessions

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 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 sessions is the business layer for sessions: listing, details with summaries, and event timelines. The HTTP API, MCP tools and context builder all use it, so they apply the same ownership rules.

Index

Constants

View Source
const HasPrompt = `EXISTS (SELECT 1 FROM events ep WHERE ep.session_id = s.session_id AND ep.event_type = 'user.prompt')`

HasPrompt is the SQL condition (on sessions aliased "s") for a session the user actually talked in. Sessions without a prompt (an agent opened and closed, or a CLI subcommand such as `claude mcp list` that fires SessionEnd) are kept but not listed, summarized or offered as context.

Variables

This section is empty.

Functions

func Events

func Events(ctx context.Context, db *sql.DB, sessionID, afterAt, afterID string, limit int) (*model.EventPage, error)

Events returns up to limit events after the (occurred_at, event_id) position.

func Get

func Get(ctx context.Context, db *sql.DB, owner, sessionID string) (*model.SessionInfo, error)

Get returns one of the owner's sessions.

func List

func List(ctx context.Context, db *sql.DB, owner string, q Query) ([]model.SessionInfo, error)

List returns the owner's sessions, most recently active first.

func Summary

func Summary(ctx context.Context, db *sql.DB, si *model.SessionInfo) (*summary.Summary, error)

Summary returns the stored summary, recomputed when the session has events newer than it (a summary job is still pending).

Types

type Query

type Query struct {
	ProjectIDs []string // empty: all of the owner's projects
	AgentType  string
	DeviceID   string
	Status     string
	ExcludeID  string
	Since      *time.Time
	// Before/BeforeID page backwards: sessions whose last activity is before
	// Before, or equal to it with a smaller session id (the last row of the
	// previous page).
	Before   *time.Time
	BeforeID string
	Limit    int
	// IncludeEmpty also lists sessions without a user prompt.
	IncludeEmpty bool
}

Query filters List.

Jump to

Keyboard shortcuts

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