session

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSessionID = errors.New("session: ID must not contain ':'")

ErrInvalidSessionID is returned by NewContext when the session ID contains the reserved separator character ":". IDs with ":" would silently corrupt the "sessionID:baseID:chunkIndex" format used by LongTermMemory and InMemoryStore to scope vector entries per session.

Functions

func IDFromContext

func IDFromContext(ctx context.Context) (string, bool)

IDFromContext extracts the session ID injected by NewContext. Returns ("", false) when no session ID is present or when the stored ID is the empty string.

Invariant: a session ID returned here never contains ":", because NewContext rejects such IDs at injection time. Callers that build entry IDs of the form "sessionID:baseID:chunkIndex" can rely on this guarantee — the first ":" always marks the boundary between the session prefix and the base ID.

func NewContext

func NewContext(ctx context.Context, id string) (context.Context, error)

NewContext returns a new context carrying the given session ID. Returns ErrInvalidSessionID if id contains ":".

Agent.Run injects the agent name here when WithName is configured. InMemoryStore.Search uses this value to filter results to a single session by matching the "sessionID:" prefix of stored entry IDs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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