session

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	ResolveHandle(h spec.SkillHandle) (spec.ProviderSkillKey, bool)
	HandleForKey(key spec.ProviderSkillKey) (spec.SkillHandle, bool)
	EnsureBody(ctx context.Context, key spec.ProviderSkillKey) (string, error)
	GetIndex(key spec.ProviderSkillKey) (spec.ProviderSkillIndexRecord, bool)
}

type NewSessionParams added in v0.6.0

type NewSessionParams struct {
	// If >0 overrides store default for this session.
	MaxActivePerSession int

	// Optional initial active skill keys (activated with LoadModeReplace).
	ActiveKeys []spec.ProviderSkillKey
}

type ProviderResolver

type ProviderResolver interface {
	Provider(skillType string) (spec.SkillProvider, bool)
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) ActivateKeys

func (s *Session) ActivateKeys(
	ctx context.Context,
	keys []spec.ProviderSkillKey,
	mode spec.LoadMode,
) ([]spec.SkillHandle, error)

func (*Session) ActiveKeys added in v0.6.0

func (s *Session) ActiveKeys(ctx context.Context) ([]spec.ProviderSkillKey, error)

ActiveKeys returns the session's active skill keys in activation order.

It also prunes keys that no longer exist in the catalog so callers don't need to handle removed-skills drift.

func (*Session) ID

func (s *Session) ID() string

func (*Session) NewRegistry

func (s *Session) NewRegistry(opts ...llmtools.RegistryOption) (*llmtools.Registry, error)

type SessionConfig

type SessionConfig struct {
	ID                  string
	Catalog             Catalog
	Providers           ProviderResolver
	MaxActivePerSession int
	Touch               func() // store-provided "touch" to keep TTL/LRU alive
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(cfg StoreConfig) *Store

func (*Store) Delete

func (st *Store) Delete(id string)

func (*Store) Get

func (st *Store) Get(id string) (*Session, bool)

func (*Store) NewSession

func (st *Store) NewSession(ctx context.Context, p NewSessionParams) (string, []spec.SkillHandle, error)

func (*Store) PruneSkill

func (st *Store) PruneSkill(key spec.ProviderSkillKey)

PruneSkill removes the given key from all sessions' active lists.

type StoreConfig

type StoreConfig struct {
	TTL                 time.Duration
	MaxSessions         int
	MaxActivePerSession int

	Catalog   Catalog
	Providers ProviderResolver
}

Jump to

Keyboard shortcuts

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