skillruntime

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest = errors.New("invalid Skill runtime request")
	ErrSkillNotFound  = errors.New("runtime Skill not found")
)

Functions

This section is empty.

Types

type ArtifactRouter

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

func NewArtifactRouter

func NewArtifactRouter(
	artifacts artifact.Reader,
	collections collection.Reader,
) (*ArtifactRouter, error)

func (*ArtifactRouter) CollectionForArtifact

func (r *ArtifactRouter) CollectionForArtifact(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (collection.CollectionRef, error)

CollectionForArtifact resolves durable ownership without projecting or opening the Skill source. Batch reconciliation can then load the owning Collection once rather than first performing an expensive single-Skill projection.

func (*ArtifactRouter) ListCollectionSkills

func (r *ArtifactRouter) ListCollectionSkills(
	ctx context.Context,
	ref collection.CollectionRef,
) ([]ResolvedArtifactSkill, error)

func (*ArtifactRouter) Register

func (r *ArtifactRouter) Register(
	kind basespec.CollectionKind,
	loader ArtifactSkillLoader,
) error

func (*ArtifactRouter) ResolveArtifactSkill

func (r *ArtifactRouter) ResolveArtifactSkill(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (ResolvedArtifactSkill, error)

type ArtifactSkillLoader

type ArtifactSkillLoader interface {
	ResolveArtifactSkill(
		ctx context.Context,
		ref artifact.ArtifactRef,
	) (ResolvedArtifactSkill, error)

	ListCollectionSkills(
		ctx context.Context,
		ref collection.CollectionRef,
	) ([]ResolvedArtifactSkill, error)
}

ArtifactSkillLoader is implemented by feature adapters. It does not decide ownership from a durable reference shape. ArtifactRouter resolves ownership from the Artifact Record and its current Collection membership first.

type ArtifactSkillSummary

type ArtifactSkillSummary struct {
	Artifact     artifact.ArtifactRef
	IsEnabled    bool
	Insert       agentskillsSpec.SkillInsert
	HasArguments bool
	HasResources bool
}

ArtifactSkillSummary is the runtime-derived summary used by durable selection validators. It contains no filesystem path and no process-local SkillDef identity.

type CloseSkillSessionRequest

type CloseSkillSessionRequest struct {
	SessionID agentskillsSpec.SessionID `path:"sessionID" required:"true"`
}

type CloseSkillSessionResponse

type CloseSkillSessionResponse struct{}

type CreateSkillSessionRequest

type CreateSkillSessionRequest struct {
	Body *CreateSkillSessionRequestBody
}

CreateSkillSessionRequest creates a session using Artifact Store identities.

type CreateSkillSessionRequestBody

type CreateSkillSessionRequestBody struct {
	// Optional: close this previous session (best-effort) before creating a new one.
	CloseSessionID agentskillsSpec.SessionID `json:"closeSessionID,omitempty"`

	MaxActivePerSession int                    `json:"maxActivePerSession,omitempty"`
	AllowArtifacts      []artifact.ArtifactRef `json:"allowArtifacts,omitempty"`
	ActiveArtifacts     []artifact.ArtifactRef `json:"activeArtifacts,omitempty"`
}

type CreateSkillSessionResponse

type CreateSkillSessionResponse struct {
	Body *CreateSkillSessionResponseBody
}

type CreateSkillSessionResponseBody

type CreateSkillSessionResponseBody struct {
	SessionID       agentskillsSpec.SessionID `json:"sessionID"`
	ActiveArtifacts []artifact.ArtifactRef    `json:"activeArtifacts"`
}

type GetSkillsPromptRequest

type GetSkillsPromptRequest struct {
	Body *GetSkillsPromptRequestBody
}

type GetSkillsPromptRequestBody

type GetSkillsPromptRequestBody struct {
	Filter *RuntimeSkillFilter `json:"filter,omitempty"`
}

type GetSkillsPromptResponse

type GetSkillsPromptResponse struct {
	Body *GetSkillsPromptResponseBody
}

type GetSkillsPromptResponseBody

type GetSkillsPromptResponseBody struct {
	Prompt string `json:"prompt"`
}

type InvokeSkillToolRequest

type InvokeSkillToolRequest struct {
	Body *InvokeSkillToolRequestBody
}

type InvokeSkillToolRequestBody

type InvokeSkillToolRequestBody struct {
	SessionID agentskillsSpec.SessionID `json:"sessionID"      required:"true"`
	ToolName  string                    `json:"toolName"       required:"true"` // "skills-load" | "skills-unload" | "skills-readresource" | "skills-runscript"
	Args      jsonutil.JSONRawString    `json:"args,omitempty"`                 // JSON object string
}

type InvokeSkillToolResponse

type InvokeSkillToolResponse struct {
	Body *InvokeSkillToolResponseBody
}

type InvokeSkillToolResponseBody

type InvokeSkillToolResponseBody struct {
	Outputs      []llmtoolsSpec.ToolOutputUnion `json:"outputs,omitempty"`
	Meta         map[string]any                 `json:"meta,omitempty"`
	IsBuiltIn    bool                           `json:"isBuiltIn"`
	IsError      bool                           `json:"isError,omitempty"`
	ErrorMessage string                         `json:"errorMessage,omitempty"`
}

type ListRuntimeSkillsRequest

type ListRuntimeSkillsRequest struct {
	Body *ListRuntimeSkillsRequestBody
}

type ListRuntimeSkillsRequestBody

type ListRuntimeSkillsRequestBody struct {
	Filter *RuntimeSkillFilter `json:"filter,omitempty"`
}

type ListRuntimeSkillsResponse

type ListRuntimeSkillsResponse struct {
	Body *ListRuntimeSkillsResponseBody
}

type ListRuntimeSkillsResponseBody

type ListRuntimeSkillsResponseBody struct {
	Skills []RuntimeSkillListItem `json:"skills"`
}

type RenderSkillRequest

type RenderSkillRequest struct {
	Body *RenderSkillRequestBody
}

type RenderSkillRequestBody

type RenderSkillRequestBody struct {
	Artifact  artifact.ArtifactRef `json:"artifact"            required:"true"`
	Arguments map[string]string    `json:"arguments,omitempty"`
}

type RenderSkillResponse

type RenderSkillResponse struct {
	Body *RenderSkillResponseBody
}

type RenderSkillResponseBody

type RenderSkillResponseBody struct {
	Text string `json:"text"`

	Insert agentskillsSpec.SkillInsert `json:"insert"`

	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	DisplayName string `json:"displayName,omitempty"`

	// SourceTags are tags parsed from SKILL.md frontmatter.
	SourceTags []string `json:"sourceTags,omitempty"`

	Resources agentskillsSpec.SkillResourceInfo `json:"resources"`

	Arguments        []agentskillsSpec.SkillArgument `json:"arguments,omitempty"`
	AppliedArguments map[string]string               `json:"appliedArguments,omitempty"`
	RawFrontmatter   map[string]any                  `json:"rawFrontmatter,omitempty"`
	Warnings         []string                        `json:"warnings,omitempty"`
}

type ResolvedArtifactSkill

type ResolvedArtifactSkill struct {
	Artifact   artifact.ArtifactRef
	Collection collection.CollectionRef
	Definition agentskillsSpec.SkillDef
	Version    string
}

func (ResolvedArtifactSkill) Validate

func (s ResolvedArtifactSkill) Validate() error

type RuntimeSkillFilter

type RuntimeSkillFilter struct {
	Types          []string                      `json:"types,omitempty"`
	Inserts        []agentskillsSpec.SkillInsert `json:"inserts,omitempty"`
	LocationPrefix string                        `json:"locationPrefix,omitempty"`
	AllowArtifacts []artifact.ArtifactRef        `json:"allowArtifacts,omitempty"`

	SessionID agentskillsSpec.SessionID     `json:"sessionID,omitempty"`
	Activity  agentskillsSpec.SkillActivity `json:"activity,omitempty"`
}

type RuntimeSkillListItem

type RuntimeSkillListItem struct {
	SkillRef artifact.ArtifactRef `json:"skillRef"`

	// Copy of the runtime-facing identity fields (excluding Location) + runtime-indexed metadata.
	// These are read-only and exist only for display/debug.
	Type        string `json:"type,omitempty"`
	Name        string `json:"name,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	Description string `json:"description,omitempty"`
	Digest      string `json:"digest,omitempty"`

	Insert    agentskillsSpec.SkillInsert     `json:"insert,omitempty"`
	Arguments []agentskillsSpec.SkillArgument `json:"arguments,omitempty"`
	// SourceTags are tags parsed from SKILL.md frontmatter.
	SourceTags     []string                          `json:"sourceTags,omitempty"`
	Resources      agentskillsSpec.SkillResourceInfo `json:"resources"`
	RawFrontmatter map[string]any                    `json:"rawFrontmatter,omitempty"`
	Warnings       []string                          `json:"warnings,omitempty"`

	// Session-scoped.
	IsActive bool `json:"isActive,omitempty"`

	// Runtime/provider error (if any) for this skill record.
	ErrorMessage string `json:"errorMessage,omitempty"`
}

RuntimeSkillListItem is keyed only by durable Artifact Store identity. SkillDef is intentionally process-local and never exposed.

type SkillRuntime

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

SkillRuntime owns the in-memory Agent Skills catalog, provider lifecycle, sessions, prompt generation, rendering, and tool invocation.

func NewSkillRuntime

func NewSkillRuntime(
	opts ...SkillRuntimeOption,
) (*SkillRuntime, error)

NewSkillRuntime creates an Artifact-backed Agent Skills runtime. Durable Skill identity is always artifact.ArtifactRef; no standalone Skill Store, bundle slug, legacy Skill ID, or source location enters this package.

func (*SkillRuntime) AgentSkillsRuntime

func (s *SkillRuntime) AgentSkillsRuntime() *agentskills.Runtime

func (*SkillRuntime) Close

func (s *SkillRuntime) Close()

func (*SkillRuntime) CloseSkillSession

func (*SkillRuntime) CreateSkillSession

func (*SkillRuntime) DescribeArtifactSkill

func (s *SkillRuntime) DescribeArtifactSkill(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (ArtifactSkillSummary, error)

DescribeArtifactSkill resolves and indexes a selected ArtifactRef through the ownership router before reading Agent Skills metadata. The Artifact record and its Collection membership, rather than reference shape, decide the owning feature adapter.

func (*SkillRuntime) GetSkillsPrompt

func (s *SkillRuntime) GetSkillsPrompt(
	ctx context.Context,
	req *GetSkillsPromptRequest,
) (*GetSkillsPromptResponse, error)

func (*SkillRuntime) InvokeSkillTool

func (s *SkillRuntime) InvokeSkillTool(
	ctx context.Context,
	req *InvokeSkillToolRequest,
) (*InvokeSkillToolResponse, error)

func (*SkillRuntime) ListRuntimeSkills

func (*SkillRuntime) ManagedCollectionRefs

func (s *SkillRuntime) ManagedCollectionRefs() []collection.CollectionRef

ManagedCollectionRefs returns derived runtime partitions. Collection kind is deliberately not encoded in a Skill reference; application feature synchronizers use their own typed Collection discovery to decide removal.

func (*SkillRuntime) RemoveCollection

func (s *SkillRuntime) RemoveCollection(
	ctx context.Context,
	ref collection.CollectionRef,
) error

func (*SkillRuntime) RenderSkill

func (s *SkillRuntime) RenderSkill(
	ctx context.Context,
	req *RenderSkillRequest,
) (*RenderSkillResponse, error)

func (*SkillRuntime) ResyncCollection

func (s *SkillRuntime) ResyncCollection(
	ctx context.Context,
	ref collection.CollectionRef,
) error

func (*SkillRuntime) RunScriptsEnabled

func (s *SkillRuntime) RunScriptsEnabled() bool

RunScriptsEnabled reports the effective shared filesystem-provider policy. Inference composition uses this value only to decide whether skills-runscript is advertised to the model.

func (*SkillRuntime) WarmCollections

func (s *SkillRuntime) WarmCollections(
	ctx context.Context,
	refs []collection.CollectionRef,
) error

WarmCollections best-effort warms process-local runtime registrations for known Collections. It is intended for optional background startup warmup.

Durable Artifact Store state remains authoritative. Failed Collections are omitted from this pass and can be resolved again through normal lazy foreground reconciliation.

type SkillRuntimeOption

type SkillRuntimeOption func(*skillRuntimeOptions) error

func WithArtifactResolver

func WithArtifactResolver(
	value *ArtifactRouter,
) SkillRuntimeOption

func WithRunScripts

func WithRunScripts(enabled bool) SkillRuntimeOption

WithRunScripts configures the shared filesystem-provider execution policy. Workspace filesystem skills and installed filesystem skills always use this same provider and therefore this same policy.

func WithRuntime

func WithRuntime(value *agentskills.Runtime) SkillRuntimeOption

Jump to

Keyboard shortcuts

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