

// ── inlined from @weft/skills ──
// -- @weft/skills/browser.d.ts --
/**
 * Skills Types
 *
 * Type definitions for workspace skills.
 * Skills are specialized instructions that extend Claude's capabilities.
 */
/**
 * Skill metadata from SKILL.md YAML frontmatter
 */
interface SkillMetadata {
    /** Display name for the skill */
    name: string;
    /** Brief description shown in skill list */
    description: string;
    /** Optional file patterns that trigger this skill */
    globs?: string[];
    /** Optional tools to always allow when skill is active */
    alwaysAllow?: string[];
    /**
     * Optional icon - emoji or URL only.
     * - Emoji: rendered directly in UI (e.g., "🔧")
     * - URL: auto-downloaded to icon.{ext} file
     * Note: Relative paths and inline SVG are NOT supported.
     */
    icon?: string;
    /** Optional source slugs to auto-enable when this skill is invoked */
    requiredSources?: string[];
}
/** Source of a loaded skill */
type SkillSource = 'global' | 'workspace' | 'project';
/**
 * Plugin name for project-level and global skills.
 *
 * The SDK derives plugin names from `path.basename()` of the registered plugin
 * directory. Both `{project}/.agents/` and `~/.agents/` share the basename
 * `.agents`, so skills from either tier resolve to `.agents:skillSlug`.
 */
declare const AGENTS_PLUGIN_NAME = ".agents";
/**
 * A loaded skill with parsed content
 */
interface LoadedSkill {
    /** Directory name (slug) */
    slug: string;
    /** Parsed metadata from YAML frontmatter */
    metadata: SkillMetadata;
    /** Full SKILL.md content (without frontmatter) */
    content: string;
    /** Absolute path to icon file if exists */
    iconPath?: string;
    /** Absolute path to skill directory */
    path: string;
    /** Where this skill was loaded from */
    source: SkillSource;
}

type SkillActivationReason = 'prompt-mention' | 'file-glob' | 'host-selection';
interface SkillActivation {
    skill: LoadedSkill;
    reason: SkillActivationReason;
}
interface CreateSkillActivationPlanOptions {
    skills: LoadedSkill[];
    prompt?: string;
    filePaths?: string[];
    selectedSkillSlugs?: string[];
    enabledSourceSlugs?: string[];
    prerequisiteFileExists?: (path: string) => boolean;
}
interface SkillPolicyExtension {
    toolName: string;
    scope: {
        type: 'skill';
        skillSlug: string;
    };
}
interface SkillActivationPlan {
    activeSkillSlugs: string[];
    activations: SkillActivation[];
    requiredSourceSlugs: string[];
    missingRequiredSourceSlugs: string[];
    policyExtensions: SkillPolicyExtension[];
    providerInstructions: string;
    prerequisiteFiles: string[];
}
declare function createSkillActivationPlan(options: CreateSkillActivationPlanOptions): SkillActivationPlan;

/**
 * Format a skill prerequisite directive that instructs the agent to read
 * SKILL.md files before taking any other action.
 *
 * Returns undefined if no prerequisite files are specified.
 */
declare function formatSkillDirective(prerequisiteFiles: string[]): string | undefined;
/**
 * Prepend a skill directive to a user message if prerequisite files exist.
 * Returns the original message if no prerequisites.
 */
declare function prependSkillDirective(message: string, prerequisiteFiles: string[]): string;

export { AGENTS_PLUGIN_NAME, type CreateSkillActivationPlanOptions, type LoadedSkill, type SkillActivation, type SkillActivationPlan, type SkillActivationReason, type SkillMetadata, type SkillPolicyExtension, type SkillSource, createSkillActivationPlan, formatSkillDirective, prependSkillDirective };

// -- @weft/skills/index.d.ts --

interface SkillValidationIssue {
    file: string;
    path: string;
    message: string;
    severity: 'error' | 'warning' | 'info';
    suggestion?: string;
}
interface SkillValidationResult {
    valid: boolean;
    errors: SkillValidationIssue[];
    warnings: SkillValidationIssue[];
}
declare function validateSkillDefinitionContent(content: string, file?: string): SkillValidationResult;

/**
 * Skills Storage
 *
 * CRUD operations for workspace skills.
 * Skills are stored in {workspace}/skills/{slug}/ directories.
 */

/** Global agent skills directory: ~/.agents/skills/ */
declare const GLOBAL_AGENT_SKILLS_DIR: string;
/** Project-level agent skills relative directory name */
declare const PROJECT_AGENT_SKILLS_DIR = ".agents/skills";
/**
 * Load a single skill from a workspace
 * @param workspaceRoot - Absolute path to workspace root
 * @param slug - Skill directory name
 */
declare function loadSkill(workspaceRoot: string, slug: string): LoadedSkill | null;
/** Invalidate the skills cache (call on working dir change or skill file events). */
declare function invalidateSkillsCache(): void;
/**
 * Load all skills from all sources (global, workspace, project)
 * Skills with the same slug are overridden by higher-priority sources.
 * Priority: global (lowest) < workspace < project (highest)
 *
 * Results are cached per (workspaceRoot, projectRoot) pair. Call
 * invalidateSkillsCache() on working directory changes or skill file events.
 *
 * @param workspaceRoot - Absolute path to workspace root
 * @param projectRoot - Optional project root (working directory) for project-level skills
 */
declare function loadAllSkills(workspaceRoot: string, projectRoot?: string): LoadedSkill[];
/**
 * Load a single skill by slug from all sources (project > workspace > global).
 * Unlike loadAllSkills(), this only reads the specific slug directory — O(1) not O(N).
 *
 * @param workspaceRoot - Absolute path to workspace root
 * @param slug - Skill slug to load
 * @param projectRoot - Optional project root for project-level skills
 */
declare function loadSkillBySlug(workspaceRoot: string, slug: string, projectRoot?: string): LoadedSkill | null;
/**
 * Get icon path for a skill
 * @param workspaceRoot - Absolute path to workspace root
 * @param slug - Skill directory name
 */
declare function getSkillIconPath(workspaceRoot: string, slug: string): string | null;
/**
 * Delete a skill from a workspace
 * @param workspaceRoot - Absolute path to workspace root
 * @param slug - Skill directory name
 */
declare function deleteSkill(workspaceRoot: string, slug: string): boolean;
interface CreateSkillInput {
    slug: string;
    name: string;
    description: string;
    content: string;
    globs?: string[];
    alwaysAllow?: string[];
    icon?: string;
    requiredSources?: string[];
}
interface UpdateSkillInput {
    name?: string;
    description?: string;
    content?: string;
    globs?: string[];
    alwaysAllow?: string[];
    icon?: string;
    requiredSources?: string[];
}
declare function createSkill(workspaceRoot: string, input: CreateSkillInput): LoadedSkill;
declare function updateSkill(workspaceRoot: string, slug: string, patch: UpdateSkillInput): LoadedSkill;
/**
 * Check if a skill exists in a workspace
 * @param workspaceRoot - Absolute path to workspace root
 * @param slug - Skill directory name
 */
declare function skillExists(workspaceRoot: string, slug: string): boolean;
/**
 * List skill slugs in a workspace
 * @param workspaceRoot - Absolute path to workspace root
 */
declare function listSkillSlugs(workspaceRoot: string): string[];
/**
 * Download an icon from a URL and save it to the skill directory.
 * Returns the path to the downloaded icon, or null on failure.
 */
declare function downloadSkillIcon(skillDir: string, iconUrl: string): Promise<string | null>;
/**
 * Check if a skill needs its icon downloaded.
 * Returns true if metadata has a URL icon and no local icon file exists.
 */
declare function skillNeedsIconDownload(skill: LoadedSkill): boolean;

export { type CreateSkillInput, GLOBAL_AGENT_SKILLS_DIR, LoadedSkill, PROJECT_AGENT_SKILLS_DIR, type SkillValidationIssue, type SkillValidationResult, type UpdateSkillInput, createSkill, deleteSkill, downloadSkillIcon, getSkillIconPath, invalidateSkillsCache, listSkillSlugs, loadAllSkills, loadSkill, loadSkillBySlug, skillExists, skillNeedsIconDownload, updateSkill, validateSkillDefinitionContent };
