skillruntime

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MPL-2.0 Imports: 19 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 added in v0.2.14

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

func NewArtifactRouter added in v0.2.14

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

func (*ArtifactRouter) ListCollectionSkills added in v0.2.14

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

func (*ArtifactRouter) Register added in v0.2.14

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

func (*ArtifactRouter) ResolveArtifactSkill added in v0.2.14

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

type ArtifactSkillLoader added in v0.2.14

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 added in v0.2.14

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 added in v0.2.14

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

type CloseSkillSessionResponse added in v0.2.14

type CloseSkillSessionResponse struct{}

type CreateSkillSessionRequest added in v0.2.14

type CreateSkillSessionRequest struct {
	Body *CreateSkillSessionRequestBody
}

CreateSkillSessionRequest creates a session using Artifact Store identities.

type CreateSkillSessionRequestBody added in v0.2.14

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 added in v0.2.14

type CreateSkillSessionResponse struct {
	Body *CreateSkillSessionResponseBody
}

type CreateSkillSessionResponseBody added in v0.2.14

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

type GetSkillsPromptRequest added in v0.2.14

type GetSkillsPromptRequest struct {
	Body *GetSkillsPromptRequestBody
}

type GetSkillsPromptRequestBody added in v0.2.14

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

type GetSkillsPromptResponse added in v0.2.14

type GetSkillsPromptResponse struct {
	Body *GetSkillsPromptResponseBody
}

type GetSkillsPromptResponseBody added in v0.2.14

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

type InvokeSkillToolRequest added in v0.2.14

type InvokeSkillToolRequest struct {
	Body *InvokeSkillToolRequestBody
}

type InvokeSkillToolRequestBody added in v0.2.14

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      JSONRawString             `json:"args,omitempty"`                 // JSON object string
}

type InvokeSkillToolResponse added in v0.2.14

type InvokeSkillToolResponse struct {
	Body *InvokeSkillToolResponseBody
}

type InvokeSkillToolResponseBody added in v0.2.14

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 JSONRawString added in v0.2.14

type JSONRawString = string

JSONRawString mirrors the ToolRuntime API style; it's a raw JSON string.

type ListRuntimeSkillsRequest added in v0.2.14

type ListRuntimeSkillsRequest struct {
	Body *ListRuntimeSkillsRequestBody
}

type ListRuntimeSkillsRequestBody added in v0.2.14

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

type ListRuntimeSkillsResponse added in v0.2.14

type ListRuntimeSkillsResponse struct {
	Body *ListRuntimeSkillsResponseBody
}

type ListRuntimeSkillsResponseBody added in v0.2.14

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

type RenderSkillRequest added in v0.2.14

type RenderSkillRequest struct {
	Body *RenderSkillRequestBody
}

type RenderSkillRequestBody added in v0.2.14

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

type RenderSkillResponse added in v0.2.14

type RenderSkillResponse struct {
	Body *RenderSkillResponseBody
}

type RenderSkillResponseBody added in v0.2.14

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 added in v0.2.14

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

func (ResolvedArtifactSkill) Validate added in v0.2.14

func (s ResolvedArtifactSkill) Validate() error

type RuntimeSkillFilter added in v0.2.14

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 added in v0.2.14

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 added in v0.2.13

func (s *SkillRuntime) Close()

func (*SkillRuntime) CloseSkillSession

func (*SkillRuntime) CreateSkillSession

func (*SkillRuntime) DescribeArtifactSkill added in v0.2.14

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 added in v0.2.14

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 added in v0.2.14

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 added in v0.2.14

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.

type SkillRuntimeOption

type SkillRuntimeOption func(*skillRuntimeOptions) error

func WithArtifactResolver added in v0.2.14

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