Documentation
¶
Index ¶
- Constants
- Variables
- func AddSource(name, url string) error
- func BuildLearnPrompt(ctx LearnContext) string
- func BuildLearnUpdatePrompt(ctx LearnContext) string
- func BuildNewSkillPrompt(description string) string
- func ComputeSkillDigest(skills []SkillEntry) string
- func DefaultSkillDirs() []string
- func ExtractSkillName(content string) string
- func FormatAuditResult(r AuditResult) string
- func FormatAuditResultColored(r AuditResult) string
- func FormatLearnSummary(ctx LearnContext, deep bool) string
- func FormatRating(rating int) string
- func FormatSkillEntry(e SkillEntry) string
- func FormatSkillInfo(s SmartSkill, path string) string
- func FormatSkillsCompact(skills []SmartSkill) string
- func FormatSkillsForPrompt(skills []SmartSkill) string
- func FormatThreatScan(name string, r ThreatScanResult) string
- func GatherDeepSourceInfo(dir string) string
- func HashSkillContent(content []byte) string
- func Install(srcDir string) error
- func PluginDataDir(pluginName string) string
- func PluginsStateDir() string
- func Remove(name string) error
- func RenderSkillCatalogMessage(skills []SkillEntry, digest string) string
- func ResolveChainConflicts(candidate SmartSkill, active map[string]SmartSkill) []string
- func ResolvePluginDirs(projectRoot string) []string
- func RunAutoSkill(dir string) (string, error)
- func SaveNewSkill(name, content string) (string, error)
- func SaveUserSources(srcs []MarketplaceSource) error
- func ScopePriority(s Scope) int
- func SkillRoots(cwd string) []string
- func SkillsLockPath(scope string) string
- func StripDangerousChars(content string) string
- func SuggestChainSkills(skill SmartSkill) (after []string, enhances []string)
- func Summary() string
- func Uninstall(name string) error
- func Validate(manifest *ToolManifest) []string
- func ValidateManifestIdentity(name, version string) []string
- func VerifyInstalledSkills(scope string) []string
- func WriteManifestV2(pluginDir string, m *ManifestV2) error
- type AuditFinding
- type AuditResult
- type AuditSeverity
- type BridgeDef
- type CommandDef
- type Components
- type DiscoveredComponents
- type DynamicPlugin
- type DynamicPluginManager
- func (dm *DynamicPluginManager) Activate(name string) error
- func (dm *DynamicPluginManager) Deactivate(name string) error
- func (dm *DynamicPluginManager) DiscoverAll() error
- func (dm *DynamicPluginManager) Events() <-chan PluginEvent
- func (dm *DynamicPluginManager) ExecuteTool(ctx context.Context, pluginName, toolName string, input json.RawMessage) (string, error)
- func (dm *DynamicPluginManager) Get(name string) (*DynamicPlugin, bool)
- func (dm *DynamicPluginManager) InstallFromGitHub(repo string) error
- func (dm *DynamicPluginManager) Reload(name string) error
- func (dm *DynamicPluginManager) Status() []PluginStatus
- func (dm *DynamicPluginManager) Uninstall(name string) error
- type FeedbackStore
- type FilesystemSkillProvider
- type GlobalSkillRegistry
- type HookDef
- type HookRegistrar
- type LearnContext
- type MCPServerSpec
- type Manifest
- type ManifestHook
- type ManifestTool
- type ManifestV2
- type MarketplaceClient
- type MarketplaceEntry
- type MarketplaceIndex
- type MarketplaceSource
- type Plugin
- type PluginBridge
- type PluginEvent
- type PluginManager
- func (pm *PluginManager) Discover() ([]*Plugin, error)
- func (pm *PluginManager) Execute(ctx context.Context, pluginName, toolName string, input json.RawMessage) (string, error)
- func (pm *PluginManager) ListTools() []PluginTool
- func (pm *PluginManager) Load(name string) (*Plugin, error)
- func (pm *PluginManager) LoadAll() error
- type PluginProcess
- type PluginState
- type PluginStatus
- type PluginTool
- type PluginToolAdapter
- func (a *PluginToolAdapter) Aliases() []string
- func (a *PluginToolAdapter) Description() string
- func (a *PluginToolAdapter) Execute(ctx context.Context, input json.RawMessage) (string, error)
- func (a *PluginToolAdapter) Name() string
- func (a *PluginToolAdapter) Parameters() map[string]interface{}
- func (a *PluginToolAdapter) PluginName() string
- func (a *PluginToolAdapter) RiskLevel() string
- func (a *PluginToolAdapter) ToolName() string
- func (a *PluginToolAdapter) Untrusted() bool
- type ProjectSignal
- type RegistryClient
- func (rc *RegistryClient) FetchIndex() (*SkillIndex, error)
- func (rc *RegistryClient) Info(name string) (*SkillEntry, error)
- func (rc *RegistryClient) Install(repo, skillName, scope string) (string, error)
- func (rc *RegistryClient) Search(query, category string) ([]SkillEntry, error)
- func (rc *RegistryClient) Trending(limit int) ([]SkillEntry, error)
- type Runtime
- type RuntimeSkillProvider
- func (p *RuntimeSkillProvider) AddSkill(entry SkillEntry)
- func (p *RuntimeSkillProvider) Get(_ context.Context, _, name string) (*SkillEntry, error)
- func (p *RuntimeSkillProvider) List(_ context.Context, _ string) ([]SkillEntry, error)
- func (p *RuntimeSkillProvider) Name() string
- func (p *RuntimeSkillProvider) RemoveSkill(name string)
- type Scope
- type ScopeDir
- type SecurityIssue
- type Skill
- type SkillChain
- type SkillEntry
- type SkillIndex
- type SkillInvocationPolicy
- type SkillProvider
- type SkillRating
- type SkillSource
- type SkillValidationFinding
- type SkillsLock
- type SkillsLockEntry
- type SmartSkill
- func InstalledSkillInfo(name string) (SmartSkill, string, bool)
- func LoadSmartSkills(dirs []string) []SmartSkill
- func MatchSkillsByContext(skills []SmartSkill, userPrompt string) []SmartSkill
- func MatchSkillsByPath(skills []SmartSkill, activePath string) []SmartSkill
- func ParseSmartSkillPublic(content string) SmartSkill
- type ThreatCategory
- type ThreatMatch
- type ThreatScanResult
- type ToolManifest
- type ToolRegistrar
- type WasmManifest
- type WasmPluginRuntime
- type WasmToolDef
Constants ¶
const ( EnvPluginRoot = "RHO_PLUGIN_ROOT" EnvPluginData = "RHO_PLUGIN_DATA" EnvPluginName = "RHO_PLUGIN_NAME" )
Env vars exported to plugin hooks and child processes (Year 0 PACK-04).
Variables ¶
var DefaultRegistry = NewSkillRegistry()
DefaultRegistry is the process-wide skill registry.
Functions ¶
func BuildLearnPrompt ¶
func BuildLearnPrompt(ctx LearnContext) string
BuildLearnPrompt creates the LLM prompt for skill recommendation.
func BuildLearnUpdatePrompt ¶
func BuildLearnUpdatePrompt(ctx LearnContext) string
BuildLearnUpdatePrompt creates a prompt to re-analyze installed skills for staleness.
func BuildNewSkillPrompt ¶
BuildNewSkillPrompt creates an LLM prompt for the skill creator wizard.
func ComputeSkillDigest ¶
func ComputeSkillDigest(skills []SkillEntry) string
ComputeSkillDigest computes a deterministic SHA-256 hex digest over the sorted (name, description) pairs of model-invocable skills.
func DefaultSkillDirs ¶
func DefaultSkillDirs() []string
DefaultSkillDirs returns Rho's official skill directories to scan for SKILL.md files. User-scoped: ~/.rho/skills/ Project-scoped (trust-gated): ./.rho/skills/, ./.zero/skills/, ./skills/
func ExtractSkillName ¶
ExtractSkillName tries to extract the skill name from generated SKILL.md content.
func FormatAuditResult ¶
func FormatAuditResult(r AuditResult) string
FormatAuditResult formats audit findings for display.
func FormatAuditResultColored ¶
func FormatAuditResultColored(r AuditResult) string
FormatAuditResultColored formats audit findings with semantic severity colors for direct terminal display (e.g. `rho skills audit`). Prefer FormatAuditResult when embedding the result inside another styled surface (e.g. chat system messages) to avoid nested ANSI codes.
func FormatLearnSummary ¶
func FormatLearnSummary(ctx LearnContext, deep bool) string
FormatLearnSummary creates a display header for the /learn command.
func FormatRating ¶
FormatRating returns a star string like "*" + "*" + "*" + "o" + "o".
func FormatSkillEntry ¶
func FormatSkillEntry(e SkillEntry) string
FormatSkillEntry formats a registry entry for display.
func FormatSkillInfo ¶
func FormatSkillInfo(s SmartSkill, path string) string
FormatSkillInfo formats detailed skill info for display.
func FormatSkillsCompact ¶
func FormatSkillsCompact(skills []SmartSkill) string
FormatSkillsCompact returns a compact listing of skill names and descriptions suitable for system prompt injection. Unlike FormatSkillsForPrompt, it omits full skill content to keep context lean. The LLM uses the Skill tool to load full content on demand.
func FormatSkillsForPrompt ¶
func FormatSkillsForPrompt(skills []SmartSkill) string
FormatSkillsForPrompt formats matched skills into text suitable for injection into the system prompt.
func FormatThreatScan ¶
func FormatThreatScan(name string, r ThreatScanResult) string
FormatThreatScan renders scan findings for CLI display.
func GatherDeepSourceInfo ¶
GatherDeepSourceInfo reads key source files to provide richer context.
func HashSkillContent ¶
HashSkillContent hashes the final SKILL.md bytes written to disk.
func PluginDataDir ¶
PluginDataDir returns the durable data directory for a plugin.
func PluginsStateDir ¶
func PluginsStateDir() string
PluginsStateDir is the user-scope plugins install root.
func RenderSkillCatalogMessage ¶
func RenderSkillCatalogMessage(skills []SkillEntry, digest string) string
RenderSkillCatalogMessage renders the canonical context statement for the skill catalog. If skills is empty, it renders an explicit tombstone retiring previously known skills.
func ResolveChainConflicts ¶
func ResolveChainConflicts(candidate SmartSkill, active map[string]SmartSkill) []string
ResolveChainConflicts checks if activating a skill conflicts with already-active skills.
func ResolvePluginDirs ¶
ResolvePluginDirs returns the list of plugin directory paths for DynamicPluginManager.
func RunAutoSkill ¶
RunAutoSkill analyzes the project and installs recommended skills.
func SaveNewSkill ¶
SaveNewSkill writes a SKILL.md to Rho user state.
func SaveUserSources ¶
func SaveUserSources(srcs []MarketplaceSource) error
SaveUserSources writes extra marketplace sources to config.
func ScopePriority ¶
ScopePriority returns lower number = higher priority (managed wins).
func SkillRoots ¶
SkillRoots returns all search directories for filesystem skills ordered from most specific (project-local cwd) to most general (user state/home).
func SkillsLockPath ¶
SkillsLockPath returns the lockfile location for an install scope.
func StripDangerousChars ¶
StripDangerousChars removes dangerous Unicode characters from content.
func SuggestChainSkills ¶
func SuggestChainSkills(skill SmartSkill) (after []string, enhances []string)
SuggestChainSkills returns skill names that should be suggested based on chain declarations.
func Validate ¶
func Validate(manifest *ToolManifest) []string
Validate checks a manifest for issues and returns a list of warnings/errors.
func ValidateManifestIdentity ¶
ValidateManifestIdentity enforces strict name/version patterns beyond the non-empty checks in ParseManifestV2.
func VerifyInstalledSkills ¶
VerifyInstalledSkills loads the scope lockfile and reports installed-skill drift. A missing or unreadable lockfile yields no warnings (nothing pinned means nothing to verify); the returned lines are for display only.
func WriteManifestV2 ¶
func WriteManifestV2(pluginDir string, m *ManifestV2) error
WriteManifestV2 writes a ManifestV2 to a plugin directory as plugin.json.
Types ¶
type AuditFinding ¶
type AuditFinding struct {
File string
Line int
Column int
Severity AuditSeverity
Category string
Message string
Char rune
}
AuditFinding is a single security issue found in a skill file.
func AuditSkillFile ¶
func AuditSkillFile(path string) ([]AuditFinding, error)
AuditSkillFile scans a single file for dangerous Unicode characters.
type AuditResult ¶
type AuditResult struct {
Findings []AuditFinding
Files int
Validation []SkillValidationFinding
}
AuditResult is the result of scanning one or more skill files.
func AuditSkillDir ¶
func AuditSkillDir(dir string) AuditResult
AuditSkillDir scans all SKILL.md files in a directory tree.
type AuditSeverity ¶
type AuditSeverity string
AuditSeverity indicates how dangerous a finding is.
const ( SeverityCritical AuditSeverity = "CRITICAL" SeverityWarning AuditSeverity = "WARNING" SeverityInfo AuditSeverity = "INFO" )
type BridgeDef ¶
type BridgeDef struct {
Command string `json:"command"` // executable name or path
Args []string `json:"args,omitempty"` // default arguments prepended to each call
Env map[string]string `json:"env,omitempty"` // extra environment variables
}
BridgeDef defines a shell-based bridge plugin that wraps an external CLI binary. This lets community plugins integrate CLI tools without writing Go code.
type CommandDef ¶
type CommandDef struct {
Name string `json:"name"`
Description string `json:"description"`
Script string `json:"script,omitempty"`
}
CommandDef defines a plugin-provided command.
type Components ¶
type Components struct {
// SkillsDir is relative to the plugin root (default "skills").
SkillsDir string `json:"skills_dir,omitempty"`
// HooksDir is relative to the plugin root (default "hooks").
HooksDir string `json:"hooks_dir,omitempty"`
// MCPFile is path to mcp.json (default "mcp.json").
MCPFile string `json:"mcp_file,omitempty"`
// Skills lists explicit skill subdirectory names under SkillsDir.
Skills []string `json:"skills,omitempty"`
// MCP lists inline MCP server specs (merged with mcp.json if present).
MCP []MCPServerSpec `json:"mcp,omitempty"`
}
Components describes optional multi-component package layout (PACK-05). Convention-over-config: when Components is nil, DiscoverComponents still scans standard subdirectories (skills/, hooks/, mcp.json).
type DiscoveredComponents ¶
type DiscoveredComponents struct {
Root string
Skills []string // absolute paths to SKILL.md parent dirs
HookFiles []string // absolute paths under hooks/
MCPServers []MCPServerSpec
HasTools bool // plugin.json tools or tools/ present
}
DiscoveredComponents is the result of scanning a multi-component plugin package.
func DiscoverComponents ¶
func DiscoverComponents(pluginDir string) (DiscoveredComponents, error)
DiscoverComponents scans a plugin directory for tools, hooks, skills, and MCP. Layout (convention):
plugin/ plugin.json # required tools/ # optional tool binaries/scripts hooks/ # optional hook scripts skills/<name>/SKILL.md mcp.json # optional MCP server definitions
func (DiscoveredComponents) ComponentSummary ¶
func (d DiscoveredComponents) ComponentSummary() string
ComponentSummary returns a short human-readable description of components.
type DynamicPlugin ¶
type DynamicPlugin struct {
Plugin // embed existing Plugin
State PluginState
Error string // last error message
ActivatedAt time.Time
Process *PluginProcess // running process (for long-lived plugins)
HookIDs []string // registered hook IDs (for cleanup on deactivate)
ManifestV2 *ManifestV2 // extended manifest if available
}
DynamicPlugin extends the base Plugin with lifecycle management.
type DynamicPluginManager ¶
type DynamicPluginManager struct {
// contains filtered or unexported fields
}
DynamicPluginManager manages dynamic plugin lifecycle.
func NewDynamicPluginManager ¶
func NewDynamicPluginManager(dirs []string, tools ToolRegistrar, hooks HookRegistrar) *DynamicPluginManager
NewDynamicPluginManager creates a new DynamicPluginManager with the given directories and registries.
func (*DynamicPluginManager) Activate ¶
func (dm *DynamicPluginManager) Activate(name string) error
Activate loads a plugin, starts its process (if daemon mode), and registers tools + hooks.
func (*DynamicPluginManager) Deactivate ¶
func (dm *DynamicPluginManager) Deactivate(name string) error
Deactivate unregisters hooks, removes tools, stops process, and sets state to Disabled.
func (*DynamicPluginManager) DiscoverAll ¶
func (dm *DynamicPluginManager) DiscoverAll() error
DiscoverAll scans all plugin directories and registers discovered plugins. Project-scoped plugin directories require folder trust when RHO_Y0_FOLDER_TRUST is on.
func (*DynamicPluginManager) Events ¶
func (dm *DynamicPluginManager) Events() <-chan PluginEvent
Events returns a channel for subscribing to plugin lifecycle events.
func (*DynamicPluginManager) ExecuteTool ¶
func (dm *DynamicPluginManager) ExecuteTool(ctx context.Context, pluginName, toolName string, input json.RawMessage) (string, error)
ExecuteTool executes a specific tool on a plugin, using the daemon if available.
func (*DynamicPluginManager) Get ¶
func (dm *DynamicPluginManager) Get(name string) (*DynamicPlugin, bool)
Get returns a specific plugin by name.
func (*DynamicPluginManager) InstallFromGitHub ¶
func (dm *DynamicPluginManager) InstallFromGitHub(repo string) error
InstallFromGitHub clones a repo into the plugins directory.
func (*DynamicPluginManager) Reload ¶
func (dm *DynamicPluginManager) Reload(name string) error
Reload deactivates and then reactivates a plugin.
func (*DynamicPluginManager) Status ¶
func (dm *DynamicPluginManager) Status() []PluginStatus
Status returns the status of all known plugins.
func (*DynamicPluginManager) Uninstall ¶
func (dm *DynamicPluginManager) Uninstall(name string) error
Uninstall deactivates a plugin and removes it from disk.
type FeedbackStore ¶
type FeedbackStore struct {
// contains filtered or unexported fields
}
FeedbackStore manages skill ratings persisted to disk.
func NewFeedbackStore ¶
func NewFeedbackStore() *FeedbackStore
NewFeedbackStore creates a store in Rho's user state directory.
func NewFeedbackStoreAt ¶
func NewFeedbackStoreAt(path string) *FeedbackStore
NewFeedbackStoreAt creates a store at a custom path (for testing).
func (*FeedbackStore) Get ¶
func (fs *FeedbackStore) Get(skill string) (SkillRating, bool)
Get returns the rating for a skill, or 0 if not rated.
func (*FeedbackStore) List ¶
func (fs *FeedbackStore) List() []SkillRating
List returns all ratings.
type FilesystemSkillProvider ¶
type FilesystemSkillProvider struct {
// contains filtered or unexported fields
}
FilesystemSkillProvider discovers skills on disk across scoped project roots and user roots.
func NewFilesystemSkillProvider ¶
func NewFilesystemSkillProvider() *FilesystemSkillProvider
NewFilesystemSkillProvider creates a filesystem provider.
func (*FilesystemSkillProvider) Get ¶
func (p *FilesystemSkillProvider) Get(ctx context.Context, cwd, name string) (*SkillEntry, error)
func (*FilesystemSkillProvider) List ¶
func (p *FilesystemSkillProvider) List(_ context.Context, cwd string) ([]SkillEntry, error)
func (*FilesystemSkillProvider) Name ¶
func (p *FilesystemSkillProvider) Name() string
type GlobalSkillRegistry ¶
type GlobalSkillRegistry struct {
// contains filtered or unexported fields
}
GlobalSkillRegistry manages multi-layer skill providers with shadowing semantics.
func NewSkillRegistry ¶
func NewSkillRegistry() *GlobalSkillRegistry
NewSkillRegistry creates a new registry initialized with the default filesystem provider.
func (*GlobalSkillRegistry) Get ¶
func (r *GlobalSkillRegistry) Get(ctx context.Context, cwd, name string) (*SkillEntry, error)
Get returns the winning skill definition for a given name in cwd.
func (*GlobalSkillRegistry) List ¶
func (r *GlobalSkillRegistry) List(ctx context.Context, cwd string) ([]SkillEntry, error)
List returns all active skills visible for the given cwd, with higher-priority providers shadowing lower-priority providers on name collision (nearest wins).
func (*GlobalSkillRegistry) Register ¶
func (r *GlobalSkillRegistry) Register(p SkillProvider) func()
Register adds a provider to the front of the provider list (higher priority) and returns a disposer function that unregisters it.
type HookRegistrar ¶
type HookRegistrar interface {
RegisterHook(id string, event string, fn func(ctx context.Context, data map[string]interface{}) error)
UnregisterHook(id string)
}
HookRegistrar allows plugins to add/remove hooks.
type LearnContext ¶
type LearnContext struct {
Signals []ProjectSignal
Installed []SmartSkill
Registry []SkillEntry
SourceInfo string // populated by /learn deep
}
LearnContext holds project analysis data for the LLM advisor.
func GatherLearnContext ¶
func GatherLearnContext(dir string) LearnContext
GatherLearnContext collects project info for the advisor.
type MCPServerSpec ¶
type MCPServerSpec struct {
Name string `json:"name"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
URL string `json:"url,omitempty"` // remote streamable HTTP
Env map[string]string `json:"env,omitempty"`
}
MCPServerSpec describes an MCP server shipped with a plugin package.
type Manifest ¶
type Manifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
Author string `json:"author,omitempty"`
Commands []CommandDef `json:"commands,omitempty"`
Skills []string `json:"skills,omitempty"`
Hooks []HookDef `json:"hooks,omitempty"`
Bridge *BridgeDef `json:"bridge,omitempty"`
}
Manifest defines a rho plugin.
func LoadManifest ¶
LoadManifest loads a plugin manifest from a directory.
type ManifestHook ¶
type ManifestHook struct {
Event string `json:"event"` // hook event type (e.g. "pre_tool", "post_query")
Command string `json:"command"` // shell command to run
Async bool `json:"async,omitempty"` // fire-and-forget
Priority int `json:"priority,omitempty"` // lower = earlier (default 100)
}
ManifestHook defines an event hook provided by a plugin.
type ManifestTool ¶
type ManifestTool struct {
Name string `json:"name"`
Description string `json:"description"`
Command string `json:"command"`
Args []string `json:"args"`
InputSchema map[string]interface{} `json:"input_schema"`
TimeoutSeconds int `json:"timeout_seconds"`
}
ManifestTool defines a tool in the manifest file.
type ManifestV2 ¶
type ManifestV2 struct {
// V1 fields (backward compatible)
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Tools []ManifestTool `json:"tools"`
Permissions []string `json:"permissions"`
MinRhoVersion string `json:"min_rho_version"`
// V2 extensions
Mode string `json:"mode,omitempty"` // "subprocess" (default) or "daemon"
Hooks []ManifestHook `json:"hooks,omitempty"` // event hooks
Config map[string]interface{} `json:"config,omitempty"` // plugin configuration
Dependencies []string `json:"dependencies,omitempty"` // other plugin names required
Repository string `json:"repository,omitempty"` // git repo URL
License string `json:"license,omitempty"`
Entrypoint string `json:"entrypoint,omitempty"` // main binary (for daemon mode)
// V3 multi-component package (Year 0 PACK-05)
// A plugin may ship tools + hooks + skills + MCP servers in one package.
Components *Components `json:"components,omitempty"`
}
ManifestV2 is the extended manifest format for dynamic plugins. It is backward compatible with the original ToolManifest (V1) format.
func ParseManifestV2 ¶
func ParseManifestV2(pluginDir string) (*ManifestV2, error)
ParseManifestV2 reads and parses a plugin.json file from the given plugin directory using the V2 manifest format. It is backward compatible with V1 manifests.
func (*ManifestV2) IsV2 ¶
func (m *ManifestV2) IsV2() bool
IsV2 returns true if any V2-specific fields are populated.
func (*ManifestV2) ToV1 ¶
func (m *ManifestV2) ToV1() *ToolManifest
ToV1 converts a V2 manifest back to the original V1 ToolManifest format. V2-only fields are lost in this conversion.
func (*ManifestV2) ValidateV2 ¶
func (m *ManifestV2) ValidateV2() []string
ValidateV2 performs extended validation on a V2 manifest.
type MarketplaceClient ¶
type MarketplaceClient struct {
Sources []MarketplaceSource
CacheDir string
// contains filtered or unexported fields
}
MarketplaceClient fetches plugin marketplace indexes and installs packages.
func NewMarketplaceClient ¶
func NewMarketplaceClient() *MarketplaceClient
NewMarketplaceClient creates a client with default sources plus user-configured ones.
func (*MarketplaceClient) FetchAll ¶
func (mc *MarketplaceClient) FetchAll() ([]MarketplaceEntry, error)
FetchAll downloads indexes from all sources and merges entries (first wins).
func (*MarketplaceClient) Find ¶
func (mc *MarketplaceClient) Find(name string) (*MarketplaceEntry, error)
Find looks up a plugin by name across all sources.
func (*MarketplaceClient) Install ¶
func (mc *MarketplaceClient) Install(entry MarketplaceEntry) (string, error)
Install installs a marketplace entry into the user plugins directory. Requires flags.Marketplace() to be enabled.
type MarketplaceEntry ¶
type MarketplaceEntry struct {
Name string `json:"name"`
Description string `json:"description"`
Repo string `json:"repo"` // owner/name or full git URL
Version string `json:"version,omitempty"`
Tags []string `json:"tags,omitempty"`
Homepage string `json:"homepage,omitempty"`
}
MarketplaceEntry is one installable plugin package in a marketplace index.
type MarketplaceIndex ¶
type MarketplaceIndex struct {
Version int `json:"version"`
UpdatedAt string `json:"updated_at,omitempty"`
Plugins []MarketplaceEntry `json:"plugins"`
}
MarketplaceIndex is the JSON schema for a marketplace source.
type MarketplaceSource ¶
MarketplaceSource is a named index URL.
func DefaultMarketplaceSources ¶
func DefaultMarketplaceSources() []MarketplaceSource
DefaultMarketplaceSources returns the built-in plugin index sources.
There are none. No repository in the GrayCode ecosystem generates a plugins-registry.json, so shipping a built-in source only produced a 404 on every `rho plugin marketplace list`. Users register real sources with `rho plugin marketplace add <name> <url>`.
type Plugin ¶
type Plugin struct {
Name string
Version string
Description string
Author string
Tools []PluginTool
Path string
Manifest *ToolManifest
WasmManifest *WasmManifest
WasmRuntime *WasmPluginRuntime
}
Plugin represents a loaded plugin with its tools and metadata.
type PluginBridge ¶
type PluginBridge struct {
// contains filtered or unexported fields
}
PluginBridge wraps a shell-based bridge plugin, executing an external CLI binary as a subprocess. It mirrors the swift sessioncapture bridge pattern: it degrades gracefully when the binary is not found in PATH.
func NewPluginBridge ¶
func NewPluginBridge(m *Manifest) *PluginBridge
NewPluginBridge locates the bridge command for a manifest and returns a bridge. Returns a non-ready bridge if the command is not found in PATH.
func (*PluginBridge) Name ¶
func (pb *PluginBridge) Name() string
Name returns the plugin name backing this bridge.
func (*PluginBridge) Ready ¶
func (pb *PluginBridge) Ready() bool
Ready reports whether the bridge command is available.
type PluginEvent ¶
type PluginEvent struct {
Type string // "activated", "deactivated", "failed", "installed"
PluginName string
Timestamp time.Time
Error string
}
PluginEvent represents a lifecycle event for a plugin.
type PluginManager ¶
type PluginManager struct {
PluginDirs []string
Loaded map[string]*Plugin
// contains filtered or unexported fields
}
PluginManager manages discovery, loading, and execution of subprocess-based plugins.
func NewPluginManager ¶
func NewPluginManager(dirs ...string) *PluginManager
NewPluginManager creates a new PluginManager with the given directories. If no directories are provided, defaults to Rho user state.
func (*PluginManager) Discover ¶
func (pm *PluginManager) Discover() ([]*Plugin, error)
Discover walks plugin directories, reads manifests, and returns available plugins.
func (*PluginManager) Execute ¶
func (pm *PluginManager) Execute(ctx context.Context, pluginName, toolName string, input json.RawMessage) (string, error)
Execute runs a tool from a loaded plugin by passing input as JSON via stdin and capturing stdout as the result. It enforces timeouts and captures stderr for errors.
func (*PluginManager) ListTools ¶
func (pm *PluginManager) ListTools() []PluginTool
ListTools returns all tools from all loaded plugins, namespaced by plugin name.
func (*PluginManager) Load ¶
func (pm *PluginManager) Load(name string) (*Plugin, error)
Load loads a specific plugin by name from the plugin directories.
func (*PluginManager) LoadAll ¶
func (pm *PluginManager) LoadAll() error
LoadAll discovers and loads all available plugins.
type PluginProcess ¶
type PluginProcess struct {
// contains filtered or unexported fields
}
PluginProcess represents a long-lived plugin daemon process.
type PluginState ¶
type PluginState string
PluginState represents the lifecycle state of a dynamic plugin.
const ( StateDiscovered PluginState = "discovered" StateLoaded PluginState = "loaded" StateActive PluginState = "active" StateFailed PluginState = "failed" StateDisabled PluginState = "disabled" )
type PluginStatus ¶
type PluginStatus struct {
Name string
Version string
State PluginState
ToolCount int
HookCount int
Error string
ActivatedAt time.Time
}
PluginStatus provides a snapshot of a plugin's state.
type PluginTool ¶
type PluginTool struct {
Name string
Description string
InputSchema map[string]interface{}
Command string
Timeout time.Duration
PluginName string // namespaced: which plugin owns this tool
IsWasm bool // true if this tool is from a WASM plugin
}
PluginTool represents a single tool provided by a plugin.
type PluginToolAdapter ¶
type PluginToolAdapter struct {
// contains filtered or unexported fields
}
PluginToolAdapter wraps a PluginTool as a tool.Tool interface so it can be registered in the main tool registry.
func (*PluginToolAdapter) Aliases ¶
func (a *PluginToolAdapter) Aliases() []string
Aliases returns alternative names for this tool.
func (*PluginToolAdapter) Description ¶
func (a *PluginToolAdapter) Description() string
Description returns the tool description.
func (*PluginToolAdapter) Execute ¶
func (a *PluginToolAdapter) Execute(ctx context.Context, input json.RawMessage) (string, error)
Execute runs the tool via the plugin manager.
func (*PluginToolAdapter) Name ¶
func (a *PluginToolAdapter) Name() string
Name returns the fully qualified tool name (plugin__pluginName__toolName).
func (*PluginToolAdapter) Parameters ¶
func (a *PluginToolAdapter) Parameters() map[string]interface{}
Parameters returns the JSON schema for tool input, pruned to the subset that strict OpenAI-compatible function-calling endpoints accept. MCP servers may publish full JSON Schema documents; mcp.SanitizeToolSchema keeps only {type, properties, required} (and a per-property keyword subset) so a verbose upstream schema does not get a tool rejected by the provider. A nil schema yields the canonical empty-object schema.
func (*PluginToolAdapter) PluginName ¶
func (a *PluginToolAdapter) PluginName() string
PluginName returns the name of the owning plugin.
func (*PluginToolAdapter) RiskLevel ¶
func (a *PluginToolAdapter) RiskLevel() string
RiskLevel returns the risk classification for this plugin tool. Daemon plugins are considered lower risk since they run in a controlled process. Subprocess plugins default to medium risk.
func (*PluginToolAdapter) ToolName ¶
func (a *PluginToolAdapter) ToolName() string
ToolName returns the unqualified tool name.
func (*PluginToolAdapter) Untrusted ¶
func (a *PluginToolAdapter) Untrusted() bool
Untrusted marks plugin tools as external implementations. A plugin's registry entry and risk label do not describe its actual side effects, so the permission engine requires explicit approval before execution.
type ProjectSignal ¶
type ProjectSignal struct {
Category string // language, framework, pattern, tool
Name string // e.g. "go", "react", "docker"
}
ProjectSignal represents a detected project characteristic.
func AnalyzeProject ¶
func AnalyzeProject(dir string) []ProjectSignal
AnalyzeProject scans the current directory for project signals.
type RegistryClient ¶
type RegistryClient struct {
IndexURL string
CacheDir string
// contains filtered or unexported fields
}
RegistryClient fetches and queries the community skill registry.
func NewRegistryClient ¶
func NewRegistryClient() *RegistryClient
NewRegistryClient creates a registry client with sensible defaults.
func (*RegistryClient) FetchIndex ¶
func (rc *RegistryClient) FetchIndex() (*SkillIndex, error)
FetchIndex downloads the registry index, using a local cache when fresh.
func (*RegistryClient) Info ¶
func (rc *RegistryClient) Info(name string) (*SkillEntry, error)
Info returns detailed information about a specific skill.
func (*RegistryClient) Install ¶
func (rc *RegistryClient) Install(repo, skillName, scope string) (string, error)
Install clones a specific skill from a GitHub repo into the skills directory. If skillName is empty, all skills in the repo are installed.
func (*RegistryClient) Search ¶
func (rc *RegistryClient) Search(query, category string) ([]SkillEntry, error)
Search filters skills by query string and optional category.
func (*RegistryClient) Trending ¶
func (rc *RegistryClient) Trending(limit int) ([]SkillEntry, error)
Trending returns the most-installed skills.
type Runtime ¶
type Runtime struct {
SmartSkills []SmartSkill
// contains filtered or unexported fields
}
Runtime manages loaded plugins and their execution.
func (*Runtime) CommandList ¶
func (r *Runtime) CommandList() []CommandDef
CommandList returns all available plugin commands.
func (*Runtime) ExecuteCommand ¶
ExecuteCommand runs a plugin command.
func (*Runtime) ListPlugins ¶
ListPlugins returns all loaded plugin manifests.
func (*Runtime) RegisterHooks ¶
func (r *Runtime) RegisterHooks()
type RuntimeSkillProvider ¶
type RuntimeSkillProvider struct {
// contains filtered or unexported fields
}
RuntimeSkillProvider provides in-memory programmatic skills.
func NewRuntimeSkillProvider ¶
func NewRuntimeSkillProvider(name string) *RuntimeSkillProvider
NewRuntimeSkillProvider creates a new in-memory skill provider.
func (*RuntimeSkillProvider) AddSkill ¶
func (p *RuntimeSkillProvider) AddSkill(entry SkillEntry)
func (*RuntimeSkillProvider) Get ¶
func (p *RuntimeSkillProvider) Get(_ context.Context, _, name string) (*SkillEntry, error)
func (*RuntimeSkillProvider) List ¶
func (p *RuntimeSkillProvider) List(_ context.Context, _ string) ([]SkillEntry, error)
func (*RuntimeSkillProvider) Name ¶
func (p *RuntimeSkillProvider) Name() string
func (*RuntimeSkillProvider) RemoveSkill ¶
func (p *RuntimeSkillProvider) RemoveSkill(name string)
type ScopeDir ¶
ScopeDir is a discovered plugin root under a scope.
func DiscoverScopeDirs ¶
DiscoverScopeDirs returns plugin directories ordered by priority (managed first). Project dirs are omitted when folder trust denies them.
type SecurityIssue ¶
SecurityIssue represents a security concern found during plugin scanning.
func ScanPlugin ¶
func ScanPlugin(pluginDir string) []SecurityIssue
ScanPlugin checks a plugin directory for suspicious content and security issues.
type Skill ¶
type Skill struct {
Name string
Description string
Content string
Path string
Provider string
ResourceBase string
Invocation SkillInvocationPolicy
}
Skill represents a project-local skill loaded from a markdown file with YAML front-matter metadata (name, description, invocation) and body content.
func LoadSkillsFromDir ¶
LoadSkillsFromDir reads all .md files from a directory, parsing YAML front-matter (name, description) and body content. Returns an empty slice (not an error) if the directory does not exist.
type SkillChain ¶
type SkillChain struct {
After []string // skills that should run before this one
Before []string // skills to suggest after this one completes
Conflicts []string // skills that cannot be active simultaneously
Enhances []string // skills that work well together (advisory)
}
SkillChain declares relationships between skills.
type SkillEntry ¶
type SkillEntry struct {
Name string `json:"name"`
Description string `json:"description"`
Author string `json:"author,omitempty"`
Repo string `json:"repo,omitempty"`
Path string `json:"path,omitempty"`
Category string `json:"category,omitempty"`
Tags []string `json:"tags,omitempty"`
Version string `json:"version,omitempty"`
License string `json:"license,omitempty"`
Agents []string `json:"agents,omitempty"`
Installs int `json:"installs,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Invocation SkillInvocationPolicy `json:"invocation"`
Provider string `json:"provider,omitempty"`
Content string `json:"content,omitempty"`
ResourceBase string `json:"resource_base,omitempty"`
}
SkillEntry is a single skill in the registry index.
func RecommendSkills ¶
func RecommendSkills(signals []ProjectSignal, skills []SkillEntry) []SkillEntry
RecommendSkills matches project signals against the registry index.
type SkillIndex ¶
type SkillIndex struct {
Version int `json:"version"`
UpdatedAt string `json:"updated_at"`
Skills []SkillEntry `json:"skills"`
}
SkillIndex is the full registry index.
type SkillInvocationPolicy ¶
type SkillInvocationPolicy struct {
ModelInvocable *bool `json:"model_invocable,omitempty"`
UserInvocable *bool `json:"user_invocable,omitempty"`
}
SkillInvocationPolicy controls which callers may invoke a skill.
func NewInvocationPolicy ¶
func NewInvocationPolicy(modelInvocable, userInvocable bool) SkillInvocationPolicy
NewInvocationPolicy returns an explicit invocation policy.
func (SkillInvocationPolicy) IsModelInvocable ¶
func (p SkillInvocationPolicy) IsModelInvocable() bool
IsModelInvocable returns true unless ModelInvocable is explicitly false.
func (SkillInvocationPolicy) IsUserInvocable ¶
func (p SkillInvocationPolicy) IsUserInvocable() bool
IsUserInvocable returns true unless UserInvocable is explicitly false.
type SkillProvider ¶
type SkillProvider interface {
Name() string
List(ctx context.Context, cwd string) ([]SkillEntry, error)
Get(ctx context.Context, cwd, name string) (*SkillEntry, error)
}
SkillProvider defines the interface for skill sources.
type SkillRating ¶
type SkillRating struct {
Skill string `json:"skill"`
Rating int `json:"rating"` // 1-5
Comment string `json:"comment,omitempty"`
Date time.Time `json:"date"`
}
SkillRating stores a user's rating for a skill.
type SkillSource ¶
type SkillSource struct {
Repo string `json:"repo,omitempty"`
Ref string `json:"ref,omitempty"`
InstalledAt string `json:"installed_at,omitempty"`
}
SkillSource tracks where an installed skill came from.
type SkillValidationFinding ¶
type SkillValidationFinding struct {
Path string
Severity AuditSeverity
Message string
}
SkillValidationFinding is a structural or security-adjacent skill metadata problem found before a skill is activated.
func ValidateSkillDir ¶
func ValidateSkillDir(dir string) []SkillValidationFinding
ValidateSkillDir validates every Markdown skill file below dir.
func ValidateSkillFile ¶
func ValidateSkillFile(path string) []SkillValidationFinding
ValidateSkillFile checks the portable metadata and local references of a SKILL.md. It complements AuditSkillFile, which scans content for hidden Unicode threats.
type SkillsLock ¶
type SkillsLock struct {
Version int `json:"version"`
Skills map[string]SkillsLockEntry `json:"skills"`
}
SkillsLock is the lockfile document.
func LoadSkillsLock ¶
func LoadSkillsLock(scope string) (*SkillsLock, error)
LoadSkillsLock reads the lockfile for a scope; a missing file yields an empty lock, not an error.
func (*SkillsLock) Delete ¶
func (l *SkillsLock) Delete(name string) bool
Delete removes a skill from the lock; returns false when absent.
func (*SkillsLock) Save ¶
func (l *SkillsLock) Save(scope string) error
Save writes the lockfile atomically.
func (*SkillsLock) Set ¶
func (l *SkillsLock) Set(name string, entry SkillsLockEntry)
Set records or updates the entry for one skill.
func (*SkillsLock) Verify ¶
func (l *SkillsLock) Verify(skillDir string) []string
Verify recomputes the installed SKILL.md hash for every locked skill and reports drift as human-readable lines: a missing SKILL.md, a hash mismatch (content changed since install), or an entry with no recorded hash (older lockfiles predate hash recording). It never modifies anything; callers decide whether to warn or fail.
type SkillsLockEntry ¶
type SkillsLockEntry struct {
Source string `json:"source"` // e.g. "owner/repo"
SourceType string `json:"source_type"` // "github"
SkillPath string `json:"skill_path,omitempty"` // path inside the repo
Commit string `json:"commit,omitempty"` // HEAD sha at clone time
ComputedHash string `json:"computed_hash"` // sha256 of the installed SKILL.md
}
SkillsLockEntry pins one installed skill.
type SmartSkill ¶
type SmartSkill struct {
Name string
Description string // used for auto-matching against user prompts
Paths []string // glob patterns that trigger this skill
Content string // skill prompt content (body of SKILL.md)
AutoInvoke bool // if true, model can trigger without user /command
Compatibility string // environment requirements (per spec)
AllowedTools string // pre-approved tools, space-separated (per spec)
Version string // semver for update tracking
Author string // skill author
License string // license identifier (MIT, Apache-2.0, etc.)
Category string // engineering, ops, testing, security, devtools, workflow
Tags []string // discovery tags
Agents []string // cross-agent compatibility (rho, claude-code, etc.)
Source SkillSource
Invoke string // namespaced invocation pattern (e.g. "/vendor:skill")
Refs []string // declared @ref() references in SKILL.md
RefDir string // path to references/ directory
Chain SkillChain
}
SmartSkill is a skill that can be auto-invoked based on file paths or user prompt context. Follows the Agent Skills spec (agentskills.io).
func InstalledSkillInfo ¶
func InstalledSkillInfo(name string) (SmartSkill, string, bool)
InstalledSkillInfo returns source metadata for an installed skill.
func LoadSmartSkills ¶
func LoadSmartSkills(dirs []string) []SmartSkill
LoadSmartSkills scans the given directories for SKILL.md files with YAML frontmatter and returns the parsed skills.
Frontmatter format:
--- name: api-review description: Reviews API endpoints for consistency paths: ["src/api/**", "routes/**"] auto-invoke: true ---
func MatchSkillsByContext ¶
func MatchSkillsByContext(skills []SmartSkill, userPrompt string) []SmartSkill
MatchSkillsByContext returns skills whose Description keywords appear in the user prompt. Uses simple case-insensitive word overlap.
func MatchSkillsByPath ¶
func MatchSkillsByPath(skills []SmartSkill, activePath string) []SmartSkill
MatchSkillsByPath returns skills whose Paths glob patterns match activePath.
func ParseSmartSkillPublic ¶
func ParseSmartSkillPublic(content string) SmartSkill
ParseSmartSkillPublic is the exported version of parseSmartSkill.
type ThreatCategory ¶
type ThreatCategory string
ThreatCategory classifies the kind of dangerous content found.
const ( ThreatCommandInjection ThreatCategory = "command-injection" ThreatDataExfiltration ThreatCategory = "data-exfiltration" ThreatEncodedPayload ThreatCategory = "encoded-payload" ThreatNetworkCalls ThreatCategory = "network-calls" )
type ThreatMatch ¶
type ThreatMatch struct {
Category ThreatCategory `json:"category"`
Pattern string `json:"pattern"`
Line int `json:"line"` // 1-indexed
Context string `json:"context"`
}
ThreatMatch is a single threat-rule hit.
type ThreatScanResult ¶
type ThreatScanResult struct {
Score int `json:"score"` // 0-100, higher = safer
Threats []ThreatMatch `json:"threats,omitempty"`
Blocked bool `json:"blocked"` // Score < threatBlockedThreshold: refuse install
Warnings bool `json:"warnings"`
}
ThreatScanResult is the outcome of scanning one skill's content.
func ScanThreats ¶
func ScanThreats(content string) ThreatScanResult
ScanThreats scans skill content for security threats and returns a safety score (0-100) with the matched rules. Empty content scores 100.
func (ThreatScanResult) Safe ¶
func (r ThreatScanResult) Safe() bool
Safe reports whether the content passed without warnings.
type ToolManifest ¶
type ToolManifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Tools []ManifestTool `json:"tools"`
Permissions []string `json:"permissions"`
MinRhoVersion string `json:"min_rho_version"`
}
ToolManifest is the manifest loaded from plugin.json for subprocess-based plugins.
func ParseManifest ¶
func ParseManifest(pluginDir string) (*ToolManifest, error)
ParseManifest reads and parses a plugin.json file from the given plugin directory.
type ToolRegistrar ¶
ToolRegistrar allows plugins to add/remove tools from the main registry.
type WasmManifest ¶
type WasmManifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Tools []WasmToolDef `json:"tools"`
Permissions []string `json:"permissions"`
MinRhoVersion string `json:"min_rho_version"`
WasmPath string `json:"wasm_path"` // relative path to .wasm file
}
WasmManifest is the manifest for WASM-based plugins.
func ParseWasmManifest ¶
func ParseWasmManifest(pluginDir string) (*WasmManifest, error)
ParseWasmManifest reads and parses a plugin.json file for a WASM plugin.
type WasmPluginRuntime ¶
type WasmPluginRuntime struct {
// contains filtered or unexported fields
}
WasmPluginRuntime runs WASM-compiled plugins using wazero (pure Go, no CGO). WASM plugins are faster than subprocess plugins (no process spawn overhead) and more secure (capability-restricted execution by default).
func NewWasmPluginRuntime ¶
func NewWasmPluginRuntime(manifestPath string) (*WasmPluginRuntime, error)
NewWasmPluginRuntime creates a WASM plugin runtime from a manifest.
func (*WasmPluginRuntime) ExecuteTool ¶
func (w *WasmPluginRuntime) ExecuteTool(ctx context.Context, toolName string, input json.RawMessage) (string, error)
ExecuteTool runs a WASM plugin tool with the given input and returns the output.
func (*WasmPluginRuntime) Name ¶
func (w *WasmPluginRuntime) Name() string
Name returns the plugin name.
type WasmToolDef ¶
type WasmToolDef struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]interface{} `json:"input_schema"`
}
WasmToolDef defines a tool in a WASM plugin manifest.
Source Files
¶
- audit.go
- auto_skill.go
- bridge.go
- components.go
- digest.go
- dynamic.go
- env.go
- feedback.go
- learn.go
- manager.go
- manifest_hardening.go
- manifest_v2.go
- marketplace.go
- plugin.go
- plugin_tool.go
- provider.go
- registry.go
- runtime.go
- scopes.go
- skill_loader.go
- skill_validate.go
- skills_auto.go
- skillslock.go
- source_inject.go
- threatscan.go
- wasm.go
- wizard.go