resources

package
v0.66.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package resources bundles embedded resources (skills, souls, delegates, templates, and builtin plugin manifest) that Stella ships with its binary. Runtime code accesses them through Registry, not by walking the filesystem directly.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltinOAuthYAML added in v0.50.5

func BuiltinOAuthYAML() []byte

BuiltinOAuthYAML returns the raw bytes of the builtin OAuth provider manifest.

func BuiltinToolsYAML added in v0.50.5

func BuiltinToolsYAML() []byte

BuiltinToolsYAML returns the raw bytes of the builtin tool plugin manifest.

func FS

func FS() fs.FS

FS returns the full embedded filesystem rooted at the package directory. Prefer SubFS for kind-scoped access.

func SubFS

func SubFS(kind Kind) (fs.FS, bool)

SubFS returns the embedded filesystem scoped to a single Kind's subdirectory. Empty (nil, false) when the kind has no known subdir.

func WriteBuiltinManifest added in v0.64.0

func WriteBuiltinManifest(sourceRoot, output string) error

WriteBuiltinManifest writes the generated source only when its bytes differ, keeping generation checks and source mtimes deterministic.

Types

type BuiltinManifest added in v0.64.0

type BuiltinManifest struct {
	Revision string                   `json:"revision"`
	Skills   []BuiltinSkillDescriptor `json:"skills"`
}

BuiltinManifest is the generated, deterministic description of every release-owned builtin skill. Revision changes when any catalog byte or mode changes.

func GenerateBuiltinManifest added in v0.64.0

func GenerateBuiltinManifest(sourceRoot string) (BuiltinManifest, error)

GenerateBuiltinManifest validates sourceRoot and returns its deterministic manifest. sourceRoot is the on-disk resources/skills directory, not a user path.

func GeneratedBuiltinManifest added in v0.64.0

func GeneratedBuiltinManifest() (BuiltinManifest, error)

GeneratedBuiltinManifest returns the manifest compiled into this binary.

type BuiltinSkillDescriptor added in v0.64.0

type BuiltinSkillDescriptor struct {
	Ref                    string             `json:"ref"`
	APIID                  string             `json:"api_id"`
	Name                   string             `json:"name"`
	Description            string             `json:"description"`
	Tags                   []string           `json:"tags"`
	DisableModelInvocation bool               `json:"disable_model_invocation"`
	Metadata               map[string]any     `json:"metadata"`
	Root                   string             `json:"root"`
	Files                  []BuiltinSkillFile `json:"files"`
	Digest                 string             `json:"digest"`
}

BuiltinSkillDescriptor is the release-owned identity and complete file list for one builtin skill. Metadata retains nested frontmatter fields verbatim.

type BuiltinSkillFile added in v0.64.0

type BuiltinSkillFile struct {
	Path   string      `json:"path"`
	Digest string      `json:"digest"`
	Size   int64       `json:"size"`
	Mode   fs.FileMode `json:"mode"`
}

BuiltinSkillFile describes one immutable file relative to a skill root.

type Kind

type Kind string

Kind identifies a builtin resource category.

const (
	KindSkill    Kind = "skill"
	KindSoul     Kind = "soul"
	KindDelegate Kind = "delegate"
	KindTemplate Kind = "template"
)

func AllKinds

func AllKinds() []Kind

AllKinds lists every supported kind.

type LegacySkillBlocker added in v0.64.0

type LegacySkillBlocker struct {
	Path string
	Kind string
}

LegacySkillBlocker is an unsupported entry in the retired extracted builtin projection. Path is relative to $STELLA_HOME/.agents/skills using slash paths.

type Registry

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

Registry is the read-only catalog of builtin resources, keyed by Kind and ID.

func Default

func Default() (*Registry, error)

Default returns the process-wide registry, loaded lazily from the embedded FS.

func Load

func Load(sourceFS fs.FS) (*Registry, error)

Load walks sourceFS and parses every supported resource kind it finds. sourceFS must have subdirectories matching Kind.subdir() for each kind to load. Missing subdirectories are silently skipped (useful for tests with partial fixtures).

func LoadBuiltin added in v0.64.0

func LoadBuiltin(sourceFS fs.FS, manifest BuiltinManifest) (*Registry, error)

LoadBuiltin loads a registry from an embedded-style filesystem and validates every manifest-described byte before making it available to callers.

func (*Registry) BuiltinSkill added in v0.64.0

func (r *Registry) BuiltinSkill(name string) (BuiltinSkillDescriptor, bool)

BuiltinSkill returns one release-owned descriptor by its stable skill name.

func (*Registry) BuiltinSkills added in v0.64.0

func (r *Registry) BuiltinSkills() []BuiltinSkillDescriptor

BuiltinSkills returns all release-owned skill descriptors in stable name order.

func (*Registry) BundlePath added in v0.64.0

func (r *Registry) BundlePath(stellaHome string) (string, error)

BundlePath returns the deterministic projection path for this registry under stellaHome. The path is derived only from a validated manifest revision.

func (*Registry) BundleRevision added in v0.64.0

func (r *Registry) BundleRevision() string

BundleRevision identifies the exact builtin bundle loaded by this registry.

Example
registry, err := Default()
if err != nil {
	panic(err)
}
fmt.Println(len(registry.BundleRevision()))
Output:
64

func (*Registry) Get

func (r *Registry) Get(kind Kind, id string) (Resource, bool)

Get fetches a single resource by kind and ID.

func (*Registry) InstallBuiltinBundle added in v0.64.0

func (r *Registry) InstallBuiltinBundle(stellaHome string) (string, error)

InstallBuiltinBundle materializes the exact embedded bundle below stellaHome. It returns only a fully verified revision and leaves an existing verified tree untouched so repeat installs do not rewrite operator-visible files.

func (*Registry) InventoryLegacySkills added in v0.64.0

func (r *Registry) InventoryLegacySkills(skillsDir string) ([]LegacySkillBlocker, error)

InventoryLegacySkills classifies the legacy extracted projection without changing it. Manifest file paths are inert old derived bytes and may have different contents or modes; every other entry blocks the bundle cutover.

func (*Registry) Kinds

func (r *Registry) Kinds() []Kind

Kinds returns the set of kinds that have at least one loaded resource.

func (*Registry) List

func (r *Registry) List(kind Kind) []Resource

List returns all resources of the given kind, sorted by ID for determinism.

func (*Registry) ReadBuiltinSkillFile added in v0.64.0

func (r *Registry) ReadBuiltinSkillFile(name, filePath string) ([]byte, BuiltinSkillFile, error)

ReadBuiltinSkillFile returns an embedded skill file selected by canonical root-relative path, together with its manifest descriptor.

func (*Registry) VerifyBuiltinBundle added in v0.64.0

func (r *Registry) VerifyBuiltinBundle(stellaHome string) error

VerifyBuiltinBundle proves that the projected revision contains exactly the manifest files and completion marker, with the expected content and modes.

type Resource

type Resource struct {
	Kind        Kind
	ID          string
	Name        string
	Description string
	Tags        []string
	Metadata    map[string]any
	Content     string
	Hash        string
}

Resource is one builtin entry of a given Kind. Content is the markdown body with frontmatter stripped. Metadata holds kind-specific frontmatter fields (anything beyond name/description/tags).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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