Documentation
¶
Overview ¶
Package skill is the managed Skill authority: the durable store of installed skills at exact revisions, project and system skills merged read-only from the filesystem, search and loading for a turn, and the management tools. Its access subpackage decides who may see or change a skill; policy holds the per-agent enabled-builtin-skill policy.
Index ¶
- Constants
- Variables
- func BuildAuthorizedPromptSection(ctx context.Context, build pkgplugins.SystemPromptContext, ...) (pkgplugins.SystemPromptSection, error)
- func CreatedBy(sk Skill) string
- func FetchSkillFiles(ctx context.Context, source string) (skillName string, files map[string]string, version string, cleanup func(), ...)
- func GitHubSource(source string) bool
- func IsCurrentSelectorMissing(err error) bool
- func IsReflectOwned(sk Skill) bool
- func MarkManualOwnedMetadata(metadata json.RawMessage) (json.RawMessage, error)
- func MarkReflectOwnedMetadata(metadata json.RawMessage) (json.RawMessage, error)
- func PolicyRef(rs ResolvedSkill) (string, bool)
- func SettingsSkillDispatch(ctx context.Context, h SettingsSkillHandler, action string, ...) (any, error)
- func SettingsSkillToolNames() []string
- func SkillDispatch(ctx context.Context, h SkillHandler, action string, args map[string]any) (any, error)
- func SkillToolNames() []string
- func ValidateSkillName(name, parentDirName string) []string
- func WithGitHubToken(ctx context.Context, token string) context.Context
- type Action
- type CatalogSkill
- type CatalogSkillDetail
- type IdentityReader
- type ManagedCreate
- type ManagedRevision
- type ManagedSkillCursor
- type ManagedSkillDelete
- type ManagedSkillFileDelete
- type ManagedSkillUpdate
- type ManagedUpdate
- type Management
- func (m *Management) Create(ctx context.Context, authority authz.Authority, in ManagedCreate) (SkillSnapshot, error)
- func (m *Management) Delete(ctx context.Context, authority authz.Authority, id, expectedVersion string) error
- func (m *Management) Get(ctx context.Context, authority authz.Authority, id string) (ManagedRevision, error)
- func (m *Management) List(ctx context.Context, authority authz.Authority, scope, targetAgentID string) ([]Skill, error)
- func (m *Management) Update(ctx context.Context, authority authz.Authority, in ManagedUpdate) (SkillSnapshot, error)
- type ManagementAccess
- type ManagementStore
- type ManagementTool
- type POSIXStore
- func (s *POSIXStore) BeginStartupReconciliation()
- func (s *POSIXStore) CreateManagedSkill(ctx context.Context, skill Skill, source map[string]string) (snapshot SkillSnapshot, resultErr error)
- func (s *POSIXStore) CreateReflectOwnedUserAgentSkill(ctx context.Context, in ReflectSkillCreate) (skill Skill, resultErr error)
- func (s *POSIXStore) DeleteManagedSkill(ctx context.Context, in ManagedSkillDelete) (resultErr error)
- func (s *POSIXStore) DeleteManagedSkillFile(ctx context.Context, in ManagedSkillFileDelete) (SkillSnapshot, error)
- func (s *POSIXStore) DeleteReflectOwnedUserAgentSkill(ctx context.Context, in ReflectSkillDelete) (skill Skill, resultErr error)
- func (s *POSIXStore) GetIdentity(ctx context.Context, id string) (*Skill, error)
- func (s *POSIXStore) ListActiveReflectOwnedUserAgentSkills(ctx context.Context, userID, agentID string) ([]Skill, error)
- func (s *POSIXStore) ListIdentityByScope(ctx context.Context, scope, userID, agentID string) ([]Skill, error)
- func (s *POSIXStore) ListIdentityCandidate(ctx context.Context, name string, vc ViewContext) ([]Skill, error)
- func (s *POSIXStore) ListIdentityVisible(ctx context.Context, vc ViewContext) ([]Skill, error)
- func (s *POSIXStore) ListSkillChangelogBySkill(ctx context.Context, skillID string, limit int) ([]SkillChangelog, error)
- func (s *POSIXStore) LoadCurrentRevision(ctx context.Context, identity Skill) (ManagedRevision, error)
- func (s *POSIXStore) LoadExactRevision(ctx context.Context, identity Skill, digest string) (ManagedRevision, error)
- func (s *POSIXStore) PatchReflectOwnedUserAgentSkill(ctx context.Context, in ReflectSkillPatch) (skill Skill, resultErr error)
- func (s *POSIXStore) SetUnavailable(cause error)
- func (s *POSIXStore) TouchReflectSkillRuntimeUseDigest(ctx context.Context, id, userID, agentID, digest string) error
- func (s *POSIXStore) UpdateManagedSkill(ctx context.Context, in ManagedSkillUpdate) (snapshot SkillSnapshot, resultErr error)
- type ProjectSnapshot
- type ReflectSkillCreate
- type ReflectSkillDelete
- type ReflectSkillPatch
- type ResolvedSkill
- type RuntimeReader
- type Service
- type SettingsSkillActionTool
- type SettingsSkillCreateInput
- type SettingsSkillDeleteInput
- type SettingsSkillGetInput
- type SettingsSkillHandler
- type SettingsSkillListInput
- type SettingsSkillUpdateInput
- type Skill
- type SkillActionTool
- type SkillChangelog
- type SkillHandler
- type SkillHomeMigrationResult
- type SkillHomeMigrator
- type SkillLoadInput
- type SkillReadAuthorizer
- type SkillReadDecision
- type SkillSearchInput
- type SkillSnapshot
- type SkillStartupReconcileResult
- type Tool
- func (t *Tool) Load(ctx context.Context, in SkillLoadInput) (any, error)
- func (t *Tool) Search(ctx context.Context, in SkillSearchInput) (any, error)
- func (t *Tool) WithAgentSkillPolicy(disabled []string) *Tool
- func (t *Tool) WithPluginVisibility(registered, enabled []string) *Tool
- func (t *Tool) WithProjectSnapshot(snapshot *ProjectSnapshot) *Tool
- type UpdatePatch
- type UpgradeResult
- type ViewContext
Constants ¶
const ( SkillStatusActive = "active" SkillStatusDeprecated = "deprecated" )
const ( ProjectSnapshotMaxFiles = 512 ProjectSnapshotMaxFileSize = int64(1 << 20) ProjectSnapshotMaxBytes = int64(16 << 20) ProjectSnapshotMaxEntries = 4096 ProjectSnapshotMaxDepth = 64 )
const ( SkillManifestFile = ".stella-skill.json" MaxManagedSkillFiles = 512 MaxManagedSkillPathBytes = 512 MaxManagedSkillFileBytes = 32 << 20 MaxManagedSkillAggregateBytes = 32 << 20 MaxManagedSkillManifestBytes = 256 << 10 MaxManagedSkillCatalogEntries = 10_000 )
const ( // ReflectSkillCreatedBy marks skills whose lifecycle is owned by Reflect. ReflectSkillCreatedBy = "reflect" // ManualSkillCreatedBy marks skills written through a user-originated path. ManualSkillCreatedBy = "manual" )
const MainFile = "SKILL.md"
const SettingsSkillToolPrefix = "settings_skill"
SettingsSkillToolPrefix is the family every generated settings_skill tool name starts with.
const SkillToolPrefix = "skill"
SkillToolPrefix is the family every generated skill tool name starts with.
Variables ¶
var ( ErrSkillHomeMigrationRequired = errors.New("Skill PostgreSQL-to-Home migration is required") ErrMarkerOutcomeUnknown = errors.New("Skill migration marker outcome is unknown") ErrSkillMigrationData = errors.New("Skill migration source data is invalid") )
var ( ErrInvalidSkillRevision = errors.New("skills: invalid revision") ErrSkillLimit = errors.New("skills: revision limit exceeded") ErrSkillCatalogLimit = errors.New("skills: catalog limit exceeded") ErrSkillDigestConflict = errors.New("skills: content digest conflict") ErrSkillDigestRequired = errors.New("skills: expected content digest is required") ErrSkillNameConflict = errors.New("skills: name already exists in scope") )
var ( ErrManagedSkillsPending = errors.New("managed Skills are waiting for startup reconciliation") )
var ( ErrSkillNotReflectOwned = errors.New("skill is not reflect-owned") ErrSkillUsageChanged = errors.New("skill usage changed") )
var ErrInvalidSkillFilePath = errors.New("invalid skill file path")
ErrInvalidSkillFilePath rejects keys whose runtime path would differ from the canonical relative path committed to Home.
var ErrNoUpgradeSource = errors.New("skill was not installed from a source")
ErrNoUpgradeSource indicates a skill has no recorded install source to re-fetch from (e.g. it was created by hand rather than installed).
var ErrProjectSnapshotLimit = errors.New("skills: project snapshot limit exceeded")
var ErrSkillNotMutable = errors.New("skill is not mutable")
ErrSkillNotMutable rejects immutable, deprecated, and project writes.
Functions ¶
func BuildAuthorizedPromptSection ¶
func BuildAuthorizedPromptSection(ctx context.Context, build pkgplugins.SystemPromptContext, project *ProjectSnapshot, reader IdentityReader, authorizer SkillReadAuthorizer) (pkgplugins.SystemPromptSection, error)
BuildAuthorizedPromptSection admits mutable Home metadata only after the runtime actor has authorized its PostgreSQL identity. Immutable project and release-builtin metadata remain filesystem/Registry reads.
func CreatedBy ¶
CreatedBy returns durable lifecycle ownership. Invalid or absent metadata has no owner and cannot enter Reflect-only paths.
func FetchSkillFiles ¶
func FetchSkillFiles(ctx context.Context, source string) (skillName string, files map[string]string, version string, cleanup func(), err error)
FetchSkillFiles resolves source, finds the skill directory, and returns the skill name, a map of file paths (relative to the skill root) → content, and the installed version (the git ref/commit for git sources, the clawhub version for clawhub sources, empty for local). cleanup is a no-op for shared-cache git and local sources; for an authenticated GitHub clone it removes the temp dir.
For github.com sources, a token carried via WithGitHubToken authenticates the clone (via BasicAuth into a private temp dir) so private repos install and anonymous rate limits are avoided.
Supported source formats:
- clawhub:<slug>[@version] — download from clawhub.ai
- owner/repo@skill-name — GitHub shorthand (via mcphub)
- GitHub/GitLab URLs — cloned via git
- local paths — read from filesystem
func GitHubSource ¶
GitHubSource reports whether source resolves to a github.com repository, which can be authenticated with a user's bound GitHub OAuth token via WithGitHubToken.
func IsCurrentSelectorMissing ¶
IsCurrentSelectorMissing reports the narrow recoverable catalog state where the identity still exists but its Home current-selector entry is absent.
func IsReflectOwned ¶
IsReflectOwned reports whether a skill is safe for Reflect-managed create, patch, or lifecycle flows. Malformed metadata is treated as not owned.
func MarkManualOwnedMetadata ¶
func MarkManualOwnedMetadata(metadata json.RawMessage) (json.RawMessage, error)
MarkManualOwnedMetadata records manual ownership without dropping installer metadata. The managed create boundary always uses this helper.
func MarkReflectOwnedMetadata ¶
func MarkReflectOwnedMetadata(metadata json.RawMessage) (json.RawMessage, error)
MarkReflectOwnedMetadata records Reflect ownership without dropping existing install/tool metadata such as created-at, source, or version.
func PolicyRef ¶
func PolicyRef(rs ResolvedSkill) (string, bool)
PolicyRef returns the stable policy identity for policy-addressable Skills.
func SettingsSkillDispatch ¶
func SettingsSkillToolNames ¶
func SettingsSkillToolNames() []string
SettingsSkillToolNames lists every generated tool name, for callers that gate on names.
func SkillDispatch ¶
func SkillToolNames ¶
func SkillToolNames() []string
SkillToolNames lists every generated tool name, for callers that gate on names.
func ValidateSkillName ¶
ValidateSkillName checks a skill name against the Agent Skills spec.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action is one generated skill tool bound to the runner's skill Tool. Every action shares that one Tool: it holds the active sandbox Session and the projection lock, which belong to the Session rather than to a call.
func NewAction ¶
func NewAction(tool *Tool, spec SkillActionTool) *Action
NewAction builds one skill action tool over the runner's skill Tool.
func (*Action) Definition ¶
func (a *Action) Definition() tools.Definition
type CatalogSkill ¶
type CatalogSkill struct {
Slug string
Name string
Summary string
Version string // empty when unknown
Downloads *int // nil in search mode (upstream search has no stats)
Installs *int // nil in search mode
UpdatedAt time.Time // zero when unknown
AuthorHandle string // empty in browse mode (upstream list has no owner)
AuthorImage string
}
CatalogSkill is one marketplace row from the ClawHub registry.
func BrowseCatalog ¶
func BrowseCatalog(ctx context.Context, q string, limit int, pageToken string) (items []CatalogSkill, nextPageToken string, err error)
BrowseCatalog returns popular skills when q is empty (paginated via the opaque pageToken) and search results when q is set (no pagination).
type CatalogSkillDetail ¶
type CatalogSkillDetail struct {
Slug string
Name string
Summary string
Version string
Readme string // SKILL.md content, empty when absent
Files []string // relative file paths, sorted
}
CatalogSkillDetail is a single marketplace skill enriched with its README and file list, fetched by downloading the skill archive from ClawHub.
func FetchCatalogDetail ¶
func FetchCatalogDetail(ctx context.Context, slug string) (CatalogSkillDetail, error)
FetchCatalogDetail resolves a skill's metadata and downloads its archive to surface the README (SKILL.md) and file list for a marketplace detail view.
type IdentityReader ¶
type IdentityReader interface {
GetIdentity(context.Context, string) (*Skill, error)
ListIdentityVisible(context.Context, ViewContext) ([]Skill, error)
ListIdentityByScope(context.Context, string, string, string) ([]Skill, error)
ListIdentityCandidate(context.Context, string, ViewContext) ([]Skill, error)
LoadCurrentRevision(context.Context, Skill) (ManagedRevision, error)
LoadExactRevision(context.Context, Skill, string) (ManagedRevision, error)
}
IdentityReader exposes PostgreSQL identity inventory separately from Home current state so consumers can authorize an actor before opening Home.
type ManagedCreate ¶
type ManagedRevision ¶
ManagedRevision is one fully verified immutable Home revision. Files and Modes are the complete bounded file tree and ContentDigest identifies these exact bytes and modes.
type ManagedSkillCursor ¶
ManagedSkillCursor identifies the last visible row in a stable lifecycle page.
type ManagedSkillDelete ¶
type ManagedSkillFileDelete ¶
type ManagedSkillFileDelete struct {
ManagedSkillDelete
Path string
}
type ManagedSkillUpdate ¶
type ManagedSkillUpdate struct {
ID string
UserID string
AgentID string
Scope string
Patch UpdatePatch
Files map[string]string
DeleteFiles []string
ConvertToManual bool
ExpectedDigest string
}
ManagedSkillUpdate applies one atomic metadata/file lifecycle mutation.
type ManagedUpdate ¶
type Management ¶
type Management struct {
// contains filtered or unexported fields
}
Management owns the application-level CRUD orchestration for managed Skills. Install and multipart upload remain HTTP-only because they accept external or unbounded sources; the model path accepts one bounded sandbox content_path.
func NewManagement ¶
func NewManagement(store ManagementStore, access ManagementAccess) *Management
func (*Management) Create ¶
func (m *Management) Create(ctx context.Context, authority authz.Authority, in ManagedCreate) (SkillSnapshot, error)
func (*Management) Get ¶
func (m *Management) Get(ctx context.Context, authority authz.Authority, id string) (ManagedRevision, error)
func (*Management) Update ¶
func (m *Management) Update(ctx context.Context, authority authz.Authority, in ManagedUpdate) (SkillSnapshot, error)
type ManagementAccess ¶
type ManagementAccess interface {
ManageScope(context.Context, authz.Authority, string, string) (userID, agentID string, err error)
ManageByID(context.Context, authz.Authority, string, authz.Action) (Skill, error)
}
ManagementAccess is the narrow Skill PEP port shared by HTTP and Stella management tools. Scope and owner identity are resolved from Authority, never supplied by a model argument.
type ManagementStore ¶
type ManagementStore interface {
IdentityReader
CreateManagedSkill(context.Context, Skill, map[string]string) (SkillSnapshot, error)
UpdateManagedSkill(context.Context, ManagedSkillUpdate) (SkillSnapshot, error)
DeleteManagedSkill(context.Context, ManagedSkillDelete) error
}
ManagementStore is the managed-Skill persistence and Home lifecycle surface.
type ManagementTool ¶
type ManagementTool struct {
// contains filtered or unexported fields
}
ManagementTool is one exact, Stella-only managed-Skill action.
func NewRuntimeManagementTool ¶
func NewRuntimeManagementTool(management *Management, runtime pkgsandbox.Session, spec SettingsSkillActionTool) *ManagementTool
func (*ManagementTool) Definition ¶
func (t *ManagementTool) Definition() tools.Definition
type POSIXStore ¶
type POSIXStore struct {
// contains filtered or unexported fields
}
POSIXStore keeps logical identity, policy evidence, and usage in PostgreSQL; mutable metadata and bytes come only from verified revisions in typed Home.
func NewPOSIXStore ¶
func NewPOSIXStore(db *pgxpool.Pool, roots home.SkillRootOpener) (*POSIXStore, error)
func (*POSIXStore) BeginStartupReconciliation ¶
func (s *POSIXStore) BeginStartupReconciliation()
BeginStartupReconciliation closes managed-Skill entry points before runtime services can race the background cutover.
func (*POSIXStore) CreateManagedSkill ¶
func (s *POSIXStore) CreateManagedSkill(ctx context.Context, skill Skill, source map[string]string) (snapshot SkillSnapshot, resultErr error)
func (*POSIXStore) CreateReflectOwnedUserAgentSkill ¶
func (s *POSIXStore) CreateReflectOwnedUserAgentSkill(ctx context.Context, in ReflectSkillCreate) (skill Skill, resultErr error)
func (*POSIXStore) DeleteManagedSkill ¶
func (s *POSIXStore) DeleteManagedSkill(ctx context.Context, in ManagedSkillDelete) (resultErr error)
func (*POSIXStore) DeleteManagedSkillFile ¶
func (s *POSIXStore) DeleteManagedSkillFile(ctx context.Context, in ManagedSkillFileDelete) (SkillSnapshot, error)
func (*POSIXStore) DeleteReflectOwnedUserAgentSkill ¶
func (s *POSIXStore) DeleteReflectOwnedUserAgentSkill(ctx context.Context, in ReflectSkillDelete) (skill Skill, resultErr error)
func (*POSIXStore) GetIdentity ¶
func (*POSIXStore) ListActiveReflectOwnedUserAgentSkills ¶
func (*POSIXStore) ListIdentityByScope ¶
func (*POSIXStore) ListIdentityCandidate ¶
func (s *POSIXStore) ListIdentityCandidate(ctx context.Context, name string, vc ViewContext) ([]Skill, error)
func (*POSIXStore) ListIdentityVisible ¶
func (s *POSIXStore) ListIdentityVisible(ctx context.Context, vc ViewContext) ([]Skill, error)
func (*POSIXStore) ListSkillChangelogBySkill ¶
func (s *POSIXStore) ListSkillChangelogBySkill(ctx context.Context, skillID string, limit int) ([]SkillChangelog, error)
func (*POSIXStore) LoadCurrentRevision ¶
func (s *POSIXStore) LoadCurrentRevision(ctx context.Context, identity Skill) (ManagedRevision, error)
func (*POSIXStore) LoadExactRevision ¶
func (s *POSIXStore) LoadExactRevision(ctx context.Context, identity Skill, digest string) (ManagedRevision, error)
func (*POSIXStore) PatchReflectOwnedUserAgentSkill ¶
func (s *POSIXStore) PatchReflectOwnedUserAgentSkill(ctx context.Context, in ReflectSkillPatch) (skill Skill, resultErr error)
func (*POSIXStore) SetUnavailable ¶
func (s *POSIXStore) SetUnavailable(cause error)
SetUnavailable fails every managed-Skill entry point after startup reconciliation proves that the authority cannot be used safely.
func (*POSIXStore) TouchReflectSkillRuntimeUseDigest ¶
func (s *POSIXStore) TouchReflectSkillRuntimeUseDigest(ctx context.Context, id, userID, agentID, digest string) error
func (*POSIXStore) UpdateManagedSkill ¶
func (s *POSIXStore) UpdateManagedSkill(ctx context.Context, in ManagedSkillUpdate) (snapshot SkillSnapshot, resultErr error)
type ProjectSnapshot ¶
type ProjectSnapshot struct {
// contains filtered or unexported fields
}
ProjectSnapshot is an immutable, bounded copy of project Skills. It contains logical sandbox identities and bytes only; it never retains a root capability or a provider/host pathname.
func SnapshotProjectSkills ¶
func SnapshotProjectSkills(ctx context.Context, root home.RootOperations, projectPath string) (*ProjectSnapshot, error)
SnapshotProjectSkills consumes an already-authorized agent-workspace root. projectPath must be its canonical relative ProjectDescriptor.Path.
type ReflectSkillCreate ¶
type ReflectSkillCreate struct {
UserID string
AgentID string
Name string
Description string
MainFileContent string
Metadata json.RawMessage
ChangelogMetadata json.RawMessage
}
type ReflectSkillDelete ¶
type ReflectSkillPatch ¶
type ResolvedSkill ¶
type ResolvedSkill struct {
Skill
// contains filtered or unexported fields
}
ResolvedSkill is a Skill resolved against immutable project or builtin bytes, or against a mutable store identity. Physical provider paths are never retained.
func (*ResolvedSkill) BuiltinFiles ¶
func (s *ResolvedSkill) BuiltinFiles() []string
func (*ResolvedSkill) ImmutableFiles ¶
func (s *ResolvedSkill) ImmutableFiles() []string
ImmutableFiles lists files from an immutable builtin or project snapshot. A nil result means the Skill is backed by the trusted runtime cache instead.
func (ResolvedSkill) IsImmutable ¶
func (s ResolvedSkill) IsImmutable() bool
IsImmutable reports whether the Skill comes from a captured project tree or the embedded release registry rather than a mutable store identity.
func (*ResolvedSkill) LoadBuiltinFile ¶
func (s *ResolvedSkill) LoadBuiltinFile(filePath string) (string, error)
func (*ResolvedSkill) LoadImmutableFile ¶
func (s *ResolvedSkill) LoadImmutableFile(filePath string) (string, error)
type RuntimeReader ¶
type RuntimeReader interface {
IdentityReader
TouchReflectSkillRuntimeUseDigest(context.Context, string, string, string, string) error
}
RuntimeReader is the complete managed-Skill read boundary used by an Agent turn. Runtime usage is pinned to the exact verified revision that was loaded; an identity-only or digest-free implementation cannot serve executable Skill content.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service merges exact mutable snapshots with immutable project and release snapshots. It never reads mutable Skill state itself.
func NewService ¶
func NewService() *Service
func (*Service) ListMerged ¶
func (s *Service) ListMerged(managedSkills []Skill, snapshot *ProjectSnapshot) []ResolvedSkill
type SettingsSkillActionTool ¶
type SettingsSkillActionTool = toolmeta.ActionTool
SettingsSkillActionTool describes one generated tool: an exact schema bound to one action.
func SettingsSkillActionTools ¶
func SettingsSkillActionTools() []SettingsSkillActionTool
SettingsSkillActionTools lists every generated tool in a stable order.
type SettingsSkillGetInput ¶
type SettingsSkillGetInput struct {
Id string `json:"id,omitempty"`
}
type SettingsSkillHandler ¶
type SettingsSkillHandler interface {
Create(context.Context, SettingsSkillCreateInput) (any, error)
Delete(context.Context, SettingsSkillDeleteInput) (any, error)
Get(context.Context, SettingsSkillGetInput) (any, error)
List(context.Context, SettingsSkillListInput) (any, error)
Update(context.Context, SettingsSkillUpdateInput) (any, error)
}
type SettingsSkillListInput ¶
type Skill ¶
type Skill struct {
ID string
Scope string // system | system_agent | user | user_agent
UserID string
AgentID string
Name string
Description string
Status string // active | deprecated
DisableModelInvocation bool
Metadata json.RawMessage
CreatedAt time.Time
UpdatedAt time.Time
Version int64
ContentDigest string
}
Skill represents a skill row (metadata only, no file content).
type SkillActionTool ¶
type SkillActionTool = toolmeta.ActionTool
SkillActionTool describes one generated tool: an exact schema bound to one action.
func RuntimeActionTools ¶
func RuntimeActionTools() []SkillActionTool
RuntimeActionTools is the existing sandbox-read surface. Managed Skill CRUD is declared in Phase 1 but remains unregistered until Phase 3 moves its application service out of the HTTP adapter.
func SkillActionTools ¶
func SkillActionTools() []SkillActionTool
SkillActionTools lists every generated tool in a stable order.
type SkillChangelog ¶
type SkillHandler ¶
type SkillHandler interface {
Load(context.Context, SkillLoadInput) (any, error)
Search(context.Context, SkillSearchInput) (any, error)
}
type SkillHomeMigrator ¶
type SkillHomeMigrator struct {
// contains filtered or unexported fields
}
func NewSkillHomeMigrator ¶
func NewSkillHomeMigrator(db *pgxpool.Pool, roots home.SkillRootOpener) (*SkillHomeMigrator, error)
func NewSkillHomeMigratorFromStore ¶
func NewSkillHomeMigratorFromStore(db *pgxpool.Pool, store *POSIXStore) (*SkillHomeMigrator, error)
NewSkillHomeMigratorFromStore shares the runtime store so a failed automatic cutover can disable managed-Skill entry points before releasing its mutation lock.
func (*SkillHomeMigrator) ReconcileStartup ¶
func (m *SkillHomeMigrator) ReconcileStartup(ctx context.Context) (SkillStartupReconcileResult, error)
ReconcileStartup performs the one-way cutover from a startup background task. The global mutation lock serializes managed-Skill writers until exact immutable Home revisions are published and verified; conflicting pre-revision mirrors are quarantined, never replaced.
type SkillLoadInput ¶
type SkillReadAuthorizer ¶
type SkillReadAuthorizer interface {
// BeginRead binds the trusted turn/worker identity to a per-row decider. A
// missing or invalid identity fails closed with an error.
BeginRead(ctx context.Context) (SkillReadDecision, error)
}
SkillReadAuthorizer authorizes DB-backed skill reads for one skills-tool invocation. It is the narrow, consumer-owned port that lets the tool use the Skill domain rules without importing internal/skill/access (which imports this package); the composition root injects a *skillaccess.Service that satisfies it. When no authorizer is injected, DB-backed reads fail closed — see the tool read paths, which drop or 404 an unauthorized DB skill rather than serving it.
type SkillReadDecision ¶
type SkillReadDecision interface {
// AllowRead reports whether the actor may read this DB skill row. A denial
// returns (false, nil); an unexpected authorization failure returns a
// non-nil error.
AllowRead(ctx context.Context, id, scope, ownerUserID, agentID string) (bool, error)
}
SkillReadDecision decides individual DB-skill reads within one invocation.
type SkillSearchInput ¶
type SkillSnapshot ¶
SkillSnapshot is the committed representation returned by an atomic Skill mutation. Files contains the complete retained path set from that transaction.
func InstallToStore ¶
func InstallToStore(ctx context.Context, store interface { CreateManagedSkill(context.Context, Skill, map[string]string) (SkillSnapshot, error) }, source, scope string, userID string, agentID string, ) (SkillSnapshot, error)
InstallToStore fetches a skill and commits it through the internal Store. scope must be one of "user", "user_agent", or "system_agent". user uses userID; user_agent uses both; system_agent uses agentID.
type SkillStartupReconcileResult ¶
type SkillStartupReconcileResult struct {
Migration SkillHomeMigrationResult
Degraded error
}
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
func NewTool ¶
func NewTool(runtime RuntimeReader, session sandboxSession, authorizer SkillReadAuthorizer) (*Tool, error)
NewTool constructs the read-only runtime Skill tool. Exact Home authority, the active Session filesystem capability, and Skill authorization are one mandatory contract; construction never creates a reduced or fallback tool.
func (*Tool) Load ¶
Load reads one installed skill's current revision and projects it into the active sandbox Session. Identity comes from the context; the read PEP runs before any Home content is opened.
func (*Tool) Search ¶
Search ranks the skills installed and visible to this agent against a task query. It returns names and descriptions only; content comes from skill_load.
func (*Tool) WithAgentSkillPolicy ¶
WithAgentSkillPolicy captures the runner's immutable policy snapshot. The next runner observes a committed mutation after local invalidation.
func (*Tool) WithPluginVisibility ¶
WithPluginVisibility limits plugin-owned system skills to enabled plugins.
func (*Tool) WithProjectSnapshot ¶
func (t *Tool) WithProjectSnapshot(snapshot *ProjectSnapshot) *Tool
type UpdatePatch ¶
type UpdatePatch struct {
Description *string
Status *string
DisableModelInvocation *bool
Metadata json.RawMessage // optional; set to overwrite
}
UpdatePatch carries optional updates for a skill's metadata fields.
type UpgradeResult ¶
type UpgradeResult struct {
Updated bool // true when the skill's files/version changed
Version string // the version now installed
PreviousVersion string // the version before the upgrade
}
UpgradeResult reports the outcome of re-fetching a skill from its source.
func UpgradeInStore ¶
func UpgradeInStore(ctx context.Context, store interface { LoadExactRevision(context.Context, Skill, string) (ManagedRevision, error) UpdateManagedSkill(context.Context, ManagedSkillUpdate) (SkillSnapshot, error) }, skill Skill, expectedDigest string, metadata json.RawMessage, ) (UpgradeResult, error)
UpgradeInStore re-fetches the skill identified by skillID from the install source recorded in its metadata and, when the resolved version differs from the stored one, replaces the skill's files and refreshes its metadata from the new SKILL.md. An unchanged version is a no-op (Updated=false), so this doubles as a check: callers get "already up to date" without a second round-trip.
For github.com sources a token carried via WithGitHubToken authenticates the fetch, exactly as during install. metadata is the skill's current metadata blob; its created-at and source are preserved while version is bumped.
type ViewContext ¶
ViewContext describes who is asking and from where. Empty fields mean no such context (e.g. empty UserID → only system skills visible).
Source Files
¶
- catalog.go
- clawhub.go
- doc.go
- fs_project.go
- home_migration.go
- install_lib.go
- lifecycle.go
- manage.go
- management.go
- management_tool.go
- plugin.go
- posix_codec.go
- posix_reflect.go
- posix_revision.go
- posix_store.go
- prompt.go
- read_authz.go
- reflect_owned.go
- reflect_write.go
- search_installed.go
- service.go
- store.go
- tool.go
- tool_settings_skill_gen.go
- tool_skill_gen.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package access owns the direct authorization rules for DB-backed Skill resources.
|
Package access owns the direct authorization rules for DB-backed Skill resources. |
|
Package policy owns the versioned Agent Skill activation setting.
|
Package policy owns the versioned Agent Skill activation setting. |