session

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 14 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) (provider.ProviderSkillKey, bool)
	HandleForKey(key provider.ProviderSkillKey) (spec.SkillHandle, bool)
	EnsureBody(ctx context.Context, key provider.ProviderSkillKey) (string, error)
	GetIndex(key provider.ProviderSkillKey) (provider.ProviderSkillIndexRecord, bool)
}

type NewSessionParams

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

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

	// Nil means unrestricted. A non-nil empty map means no skill is allowed.
	AllowedKeys map[provider.ProviderSkillKey]struct{}
}

type ProviderResolver

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

type Session

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

func (*Session) ActivateKeys

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

func (*Session) ActiveKeys

func (s *Session) ActiveKeys(ctx context.Context) ([]provider.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) AllowsKey

func (s *Session) AllowsKey(key provider.ProviderSkillKey) bool

AllowsKey reports whether this session may use key. It is exported only to sibling runtime packages through the module's internal boundary.

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

	// Nil means unrestricted. A non-nil empty map means no skill is allowed.
	AllowedKeys       map[provider.ProviderSkillKey]struct{}
	SupportsRunScript bool
}

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 provider.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

	SupportsRunScript bool
}

Jump to

Keyboard shortcuts

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