feat: add skills system for extensible capability packages
Implement a three-tier skill system (bundled/managed/workspace) that extends Flynn's abilities via SKILL.md instructions injected into the system prompt. - SkillManifest/Skill types with requirements gating (OS, binaries, env) - Loader: discovers skills from directories, validates manifests, checks system requirements, infers manifest from SKILL.md if missing - SkillRegistry: holds skills, generates system prompt additions, supports override by name (workspace > managed > bundled) - SkillInstaller: copies/removes skills in managed directory with upgrade support - Config: add skills.workspace_dir, managed_dir, bundled_dir options - Daemon: loads all skills at startup, injects available skill instructions into the system prompt - Tests: 45 new tests (loader 22, registry 11, installer 12)
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Skills system type definitions.
|
||||
*
|
||||
* Skills are modular capability packages that extend Flynn's abilities.
|
||||
* Each skill lives in its own directory with a manifest.json and SKILL.md.
|
||||
*/
|
||||
|
||||
/** Three tiers of skills: shipped with Flynn, installed via CLI, or user-created. */
|
||||
export type SkillTier = 'bundled' | 'managed' | 'workspace';
|
||||
|
||||
/** Requirements that must be met for a skill to be available. */
|
||||
export interface SkillRequirements {
|
||||
/** OS platforms the skill supports (e.g., ['linux', 'darwin']). Empty = all. */
|
||||
os?: string[];
|
||||
/** Binaries that must exist in PATH (e.g., ['git', 'docker']). */
|
||||
binaries?: string[];
|
||||
/** Environment variables that must be set (e.g., ['GITHUB_TOKEN']). */
|
||||
env?: string[];
|
||||
}
|
||||
|
||||
/** Manifest for a skill (manifest.json). */
|
||||
export interface SkillManifest {
|
||||
/** Unique skill name (e.g., 'git', 'web-search'). */
|
||||
name: string;
|
||||
/** Human-readable description. */
|
||||
description: string;
|
||||
/** Semantic version string. */
|
||||
version: string;
|
||||
/** Author name or identifier. */
|
||||
author?: string;
|
||||
/** Skill tier. */
|
||||
tier: SkillTier;
|
||||
/** System requirements for availability gating. */
|
||||
requirements?: SkillRequirements;
|
||||
/** Tool names this skill provides (informational — not enforced). */
|
||||
tools?: string[];
|
||||
/** npm/system dependencies needed. */
|
||||
dependencies?: string[];
|
||||
}
|
||||
|
||||
/** A loaded skill ready for use. */
|
||||
export interface Skill {
|
||||
/** The parsed manifest. */
|
||||
manifest: SkillManifest;
|
||||
/** Content of SKILL.md — injected into the system prompt. */
|
||||
instructions: string;
|
||||
/** Absolute path to the skill directory. */
|
||||
directory: string;
|
||||
/** Whether the skill's requirements are met on this system. */
|
||||
available: boolean;
|
||||
/** If not available, the reason(s) why. */
|
||||
unavailableReasons?: string[];
|
||||
}
|
||||
Reference in New Issue
Block a user