runtime

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*runtimeOptions) error

func WithMaxActivePerSession

func WithMaxActivePerSession(n int) Option

func WithMaxSessions

func WithMaxSessions(maxSessions int) Option

func WithProvider

func WithProvider(p provider.SkillProvider) Option

func WithSessionTTL

func WithSessionTTL(ttl time.Duration) Option

type RenderSkillOut

type RenderSkillOut struct {
	document.RenderSkillDocumentOut

	Resources provider.SkillResourceInfo `json:"resources"`
}

type RenderSkillParams

type RenderSkillParams struct {
	// Def is the exact host/lifecycle skill definition previously added to the runtime.
	Def provider.SkillDef

	// Arguments are named string values used for $name and {{name}} substitution.
	Arguments map[string]string
}

type Runtime

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

func New

func New(opts ...Option) (*Runtime, error)

func (*Runtime) AddSkill

func (r *Runtime) AddSkill(ctx context.Context, def provider.SkillDef) (spec.SkillRecord, error)

AddSkill indexes and registers a skill into the runtime-owned catalog.

IMPORTANT CONTRACT:

  • This is a HOST/LIFECYCLE API.
  • It accepts and returns only the user-provided skill definition (provider.SkillDef).
  • Provider canonicalization/cleanup is internal only and MUST NOT be exposed via this API.

func (*Runtime) CloseSession

func (r *Runtime) CloseSession(ctx context.Context, sid spec.SessionID) error

func (*Runtime) ListSkills

func (r *Runtime) ListSkills(ctx context.Context, filter *SkillListFilter) ([]spec.SkillRecord, error)

ListSkills lists skills for HOST/LIFECYCLE usage.

IMPORTANT CONTRACT:

  • Returns only user-provided skill definitions in SkillRecord.Def.
  • Filters (NamePrefix/LocationPrefix) apply to user-provided Def fields (not LLM-facing names).

func (*Runtime) NewSession

func (r *Runtime) NewSession(ctx context.Context, opts ...SessionOption) (spec.SessionID, []provider.SkillDef, error)

NewSession creates a new session.

IMPORTANT CONTRACT:

  • This is a HOST/LIFECYCLE API.
  • It accepts and returns skill definitions (provider.SkillDef), never LLM handles.

func (*Runtime) NewSessionRegistry

func (r *Runtime) NewSessionRegistry(
	ctx context.Context,
	sid spec.SessionID,
	opts ...llmtools.RegistryOption,
) (*llmtools.Registry, error)

func (*Runtime) ProviderTypes

func (r *Runtime) ProviderTypes() []string

ProviderTypes returns the registered provider type keys (e.g. "fs").

func (*Runtime) RemoveSkill

func (r *Runtime) RemoveSkill(ctx context.Context, def provider.SkillDef) (spec.SkillRecord, error)

RemoveSkill removes a skill from the catalog (and prunes it from all sessions).

IMPORTANT CONTRACT:

  • This is a HOST/LIFECYCLE API.
  • Removal is by the exact user-provided definition that was added.
  • No canonicalization-based matching is performed (to avoid internal cleanup becoming user-facing).

func (*Runtime) RenderSkill

func (r *Runtime) RenderSkill(ctx context.Context, p RenderSkillParams) (RenderSkillOut, error)

RenderSkill renders a skill body using the FlexiGPT skill extensions.

This is a HOST/LIFECYCLE API intended for app wrappers and chat UIs. It does not activate the skill in a session and it never executes commands from SKILL.md.

func (*Runtime) SkillsPrompt

func (r *Runtime) SkillsPrompt(ctx context.Context, f *SkillFilter) (string, error)

SkillsPrompt builds prompt-facing text for available and/or active skills.

Output rules:

  • If only one section is requested, the return value is exactly that section.
  • If both sections are requested, the output is wrapped in: <<<SKILLS_PROMPT>>> ... <<<END_SKILLS_PROMPT>>>

func (*Runtime) SupportsRunScript

func (r *Runtime) SupportsRunScript() bool

type SessionOption

type SessionOption func(*newSessionOptions) error

SessionOption configures Runtime.NewSession.

func WithSessionActiveSkills

func WithSessionActiveSkills(defs []provider.SkillDef) SessionOption

WithSessionActiveSkills sets the initial active skills for the new session (host/lifecycle defs). These are activated during session creation.

func WithSessionAllowedSkills

func WithSessionAllowedSkills(defs []provider.SkillDef) SessionOption

WithSessionAllowedSkills restricts all session operations to these exact host/lifecycle definitions. Calling it with an empty slice creates a session with no allowed skills. Omitting it leaves the session unrestricted.

func WithSessionMaxActivePerSession

func WithSessionMaxActivePerSession(n int) SessionOption

WithSessionMaxActivePerSession overrides the max active skills for this session only. If n <= 0, it is ignored (defaults apply).

type SkillFilter

type SkillFilter struct {
	// Types restricts to provider types (e.g. ["fs"]). Empty means "all".
	Types []string

	// NamePrefix restricts to LLM-visible names with this prefix.
	NamePrefix string

	// LocationPrefix restricts to skills whose (user-provided) location starts with this prefix.
	LocationPrefix string

	// AllowSkills restricts to an explicit allowlist of host/lifecycle skill defs. Empty means "all".
	AllowSkills []provider.SkillDef

	// SessionID optionally scopes active/inactive filtering.
	SessionID spec.SessionID

	// Activity defaults to SkillActivityAny.
	Activity spec.SkillActivity
}

SkillFilter is an optional filter for listing/prompting skills (LLM/prompt-facing).

Semantics:

  • Types/NamePrefix/LocationPrefix/AllowSkills always apply.
  • SessionID (optional) allows filtering/annotating by "active in this session".
  • Activity controls whether to include active, inactive, or both.

Defaults:

  • Activity defaults to "any".
  • If SessionID is empty, no active skills exist.

IMPORTANT CONTRACT:

  • NamePrefix matches the LLM-visible computed handle name (not the host skill def name).
  • LocationPrefix matches the user-provided location (not provider-canonicalized).

type SkillListFilter

type SkillListFilter struct {
	Types          []string
	NamePrefix     string
	LocationPrefix string
	AllowSkills    []provider.SkillDef

	Inserts []document.SkillInsert

	SessionID spec.SessionID
	Activity  spec.SkillActivity
}

SkillListFilter is a HOST/LIFECYCLE listing filter. Unlike SkillFilter (prompt), NamePrefix applies to the user-provided skill name (def.name), not the LLM-visible computed handle name.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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