/**
 * LLM-Based Plugin Detection
 *
 * Replaces unreliable grep-based keyword matching with Claude LLM calls.
 * Uses Haiku model for fast, accurate intent detection.
 *
 * Key features:
 * - Understands context ("don't use React" → no React plugin)
 * - Cross-platform execution (Windows, macOS, Linux)
 * - Graceful degradation when Claude CLI unavailable
 * - Proper error handling throughout
 *
 * @module core/lazy-loading/llm-plugin-detector
 */
import { detectClaudeCli } from '../../utils/claude-cli-detector.js';
/** Max chars of user prompt sent to Haiku for intent detection */
export declare const MAX_DETECTION_USER_PROMPT_LENGTH = 3000;
/** Max chars for the additionalContext returned from the UserPromptSubmit hook.
 * v1.0.260: Synced with hook (was 8000, reduced to 3000 to prevent prompt overflow).
 * Must match MAX_ADDITIONAL_CONTEXT_LENGTH in user-prompt-submit.sh. */
export declare const MAX_ADDITIONAL_CONTEXT_LENGTH = 3000;
/** Max chars of user prompt embedded in SKILL FIRST args.
 * v1.0.260: Synced with hook (was 2000, reduced to 800).
 * Note: v1.0.260 removed prompt embedding from SKILL FIRST entirely,
 * but this constant is kept for any remaining truncation use. */
export declare const MAX_SKILL_FIRST_PROMPT_LENGTH = 800;
/**
 * Truncate a user prompt for the detect-intent Haiku call.
 * The first N chars are sufficient for intent classification.
 */
export declare function truncateForDetection(prompt: string): string;
/**
 * Truncate a user prompt for embedding in SKILL FIRST args.
 * The original prompt is already in the user message — no need to duplicate it fully.
 */
export declare function truncateForSkillFirstArgs(prompt: string): string;
/**
 * Truncate the additionalContext output from the UserPromptSubmit hook.
 * Prevents context inflation that can push the main model past limits.
 */
export declare function truncateAdditionalContext(context: string): string;
/**
 * Plugin auto-load configuration from .specweave/config.json
 */
export interface PluginAutoLoadConfig {
    /** Whether auto-loading is enabled at all */
    enabled: boolean;
    /** If true, only suggest plugins without installing them */
    suggestOnly: boolean;
}
/**
 * Read plugin auto-load configuration from .specweave/config.json
 *
 * @returns Config object with enabled/suggestOnly flags
 */
export declare function readPluginAutoLoadConfig(): PluginAutoLoadConfig;
/**
 * Plugins that remain in specweave marketplace (installed locally)
 *
 * IMPORTANT: Plugin names use marketplace short names `sw-*` (not directory names `specweave-*`)
 * This matches the plugin names in marketplace.json and what `claude plugin install` expects.
 *
 * Note: Release, diagrams, and docs are now merged into CORE sw plugin (v1.0.130+)
 * - sw:npm, sw:release skills are built-in
 * - mermaid, c4, architecture diagram skills are built-in
 * - docs-writer, sync-docs skills are built-in
 *
 * v2.1.0: Domain skills live in vskill marketplace as per-category plugins.
 * Only workflow/integration plugins remain here.
 */
export declare const SPECWEAVE_PLUGINS: readonly ["sw", "sw-github", "sw-jira", "sw-ado", "sw-release", "sw-diagrams", "sw-docs", "sw-media"];
export type SpecWeavePlugin = (typeof SPECWEAVE_PLUGINS)[number];
/**
 * Combined list of all known plugins for validation.
 * Only specweave plugins — vskill marketplace plugins have been removed (v1.0.533).
 */
export declare const ALL_KNOWN_PLUGINS: readonly ["sw", "sw-github", "sw-jira", "sw-ado", "sw-release", "sw-diagrams", "sw-docs", "sw-media"];
export type KnownPlugin = SpecWeavePlugin;
/**
 * All valid plugins — only specweave plugins (v1.0.533: vskill removed).
 */
export declare const ALL_VALID_PLUGINS: readonly ["sw", "sw-github", "sw-jira", "sw-ado", "sw-release", "sw-diagrams", "sw-docs", "sw-media"];
export type ValidPlugin = KnownPlugin;
export interface VskillPluginEntry {
    keywords: string[];
    shortKeywords: string[];
    description: string;
    installCommand: string;
}
export interface VskillMatch {
    plugin: string;
    matchedKeyword: string;
    installCommand: string;
}
export declare const VSKILL_PLUGIN_REGISTRY: Record<string, VskillPluginEntry>;
export declare function detectVskillPlugins(prompt: string): VskillMatch[];
/**
 * Check if a plugin is a SpecWeave plugin (installed from local specweave marketplace)
 */
export declare function isSpecWeavePlugin(plugin: string): plugin is SpecWeavePlugin;
/**
 * Check if a plugin is any known plugin (specweave only, v1.0.533).
 */
export declare function isKnownPlugin(plugin: string): plugin is KnownPlugin;
/**
 * Result of Claude CLI availability check
 */
export interface ClaudeCliStatus {
    available: boolean;
    path?: string;
    version?: string;
    error?: string;
}
/**
 * Increment recommendation action types
 *
 * - 'new': User should create a new increment (feature work, multi-file changes)
 * - 'reopen': User should reopen an existing increment (related fix, continuation)
 * - 'small_fix': No increment needed (typo, config tweak, single-line fix)
 * - 'hotfix': Urgent production bug (creates increment with --type=hotfix)
 * - 'none': No recommendation (question, general chat, unclear intent)
 */
export type IncrementAction = 'new' | 'reopen' | 'small_fix' | 'hotfix' | 'none';
/**
 * Increment recommendation from LLM analysis
 */
export interface IncrementRecommendation {
    /** Recommended action */
    action: IncrementAction;
    /** Confidence score (0-1) for this recommendation */
    confidence: number;
    /** Whether increment creation is MANDATORY (LLM decides, not config) */
    mandatory: boolean;
    /** Suggested increment name (for 'new' action) */
    suggestedName?: string;
    /** Related increment ID pattern (for 'reopen' action, e.g., "login", "auth") */
    relatedKeyword?: string;
    /** Brief explanation of why this action is recommended */
    reasoning: string;
}
/**
 * Context about an active increment for LLM reopen detection
 */
export interface ActiveIncrementContext {
    id: string;
    name: string;
    type: string;
    status: string;
}
/**
 * When to invoke a skill in the workflow
 *
 * - 'immediate': Invoke right away (simple tasks, no increment needed)
 * - 'after_increment': Create increment first, then invoke
 * - 'after_planning': Use plan mode first, get approval, then invoke
 * - 'with_primary': Invoke alongside primary skill (parallel)
 * - 'after_primary': Invoke after primary skill completes (sequential)
 */
export type SkillInvokeTiming = 'immediate' | 'after_increment' | 'after_planning' | 'with_primary' | 'after_primary';
/**
 * Priority level for skills
 *
 * - 'primary': Main skill for the task (only one)
 * - 'secondary': Supporting skill (can be multiple)
 */
export type SkillPriority = 'primary' | 'secondary';
/**
 * Information about a skill to invoke
 */
export interface SkillInfo {
    /** Skill name (e.g., "architect", "nextjs") */
    name: string;
    /** Plugin that provides this skill (e.g., "backend", "sw-github") */
    plugin: string;
    /** Full qualified name for invocation (e.g., "backend:dotnet", "testing:playwright") */
    fullName: string;
    /** Priority level */
    priority: SkillPriority;
    /** When to invoke this skill in the workflow */
    invokeWhen: SkillInvokeTiming;
    /** Brief reason why this skill is recommended */
    reason: string;
}
/**
 * Workflow information for skill orchestration
 */
export interface WorkflowInfo {
    /** Whether to suggest entering plan mode first */
    suggestPlanMode: boolean;
    /** Ordered phases of the workflow */
    phases: string[];
}
/**
 * Skill routing recommendation from LLM analysis
 */
export interface SkillRouting {
    /** Skills to invoke, in priority order */
    skills: SkillInfo[];
    /** Workflow information */
    workflow: WorkflowInfo;
    /** Confidence score (0-1) for routing decision */
    confidence: number;
    /** Brief explanation of routing decision */
    reasoning: string;
}
/**
 * Skill invocation recommendation from LLM analysis (v1.0.168)
 *
 * Tells Claude which skill to invoke for the task
 * NOTE: LSP plugins (csharp-lsp, typescript-lsp) are NOT skills - they work automatically!
 */
export interface SkillInvocation {
    /** Full skill name (e.g., "ml:engineer", "payments:payment-core") */
    skill: string;
    /** Why this skill should be used */
    reason: string;
    /** Whether Claude MUST use this skill */
    mandatory: boolean;
}
/**
 * LSP operation types for code intelligence
 */
export type LspOperation = 'references' | 'definition' | 'hover' | 'symbols' | null;
/**
 * Supported languages for LSP operations
 */
export type LspLanguage = 'typescript' | 'python' | 'rust' | 'go' | 'csharp' | 'java' | null;
/**
 * LSP recommendation from LLM analysis (v1.0.198+)
 *
 * Part of unified intent detection - LLM decides if LSP operations are needed
 * for the current prompt, eliminating the need for separate LSP detection.
 */
export interface LspRecommendation {
    /** Whether LSP operation is needed for this prompt */
    needed: boolean;
    /** The specific LSP operation to perform */
    operation: LspOperation;
    /** The detected programming language (for server selection) */
    language: LspLanguage;
    /** Whether workspace warm-up is required before the operation */
    warmupRequired: boolean;
}
/**
 * Result of LLM-based plugin detection
 *
 * v1.0.159: plugins now includes both SpecWeave (sw-*) and official plugins
 * v1.0.198: Added lsp field for unified LSP detection
 */
export interface LLMDetectionResult {
    success: boolean;
    plugins: ValidPlugin[];
    confidence: number;
    reasoning?: string;
    error?: string;
    durationMs: number;
    /** Increment recommendation (v1.0.141+) */
    increment?: IncrementRecommendation;
    /** Skill routing recommendation (v1.0.150+) */
    routing?: SkillRouting;
    /** Skill invocation recommendation (v1.0.168) */
    skillInvocation?: SkillInvocation;
    /** LSP operation recommendation (v1.0.198+) */
    lsp?: LspRecommendation;
}
/**
 * Result of plugin installation via CLI
 */
export interface PluginInstallResult {
    success: boolean;
    plugin: string;
    error?: string;
    alreadyInstalled?: boolean;
}
/**
 * Clear the cached CLI status (useful for testing)
 */
export declare function clearCliCache(): void;
/**
 * Get the current CLI detection status (for debugging/testing)
 */
export declare function getCliStatus(): ReturnType<typeof detectClaudeCli> | null;
/**
 * Check if Claude CLI is available
 *
 * REFACTORED: Uses canonical implementation from utils/claude-cli-detector.ts
 * which handles all edge cases:
 * - Binary in PATH
 * - Shell functions in .zshrc/.bashrc
 * - Shell aliases
 * - npm global paths (including nvm versions)
 *
 * Also populates the cache for use by executeClaudeCli().
 *
 * @returns Status object with availability and path info
 */
export declare function isClaudeCliAvailable(): ClaudeCliStatus;
/**
 * Detect plugins needed for a user prompt using Claude LLM
 *
 * @param userPrompt - The user's prompt to analyze
 * @param timeout - Timeout in milliseconds (default: 30000)
 * @returns Detection result with plugins to install
 */
export declare function detectPluginsViaLLM(userPrompt: string, timeout?: number, // v1.0.159: Reduced to 15s with --setting-sources "" optimization (CLI starts in <1s)
activeIncrements?: ActiveIncrementContext[]): Promise<LLMDetectionResult>;
/**
 * Install a plugin using native Claude plugin system.
 *
 * @deprecated v1.0.535: On-demand plugin installation removed.
 * All plugins are now installed at init time via direct file copy
 * to .claude/skills/. This function is a no-op that returns success.
 *
 * @param pluginName - Name of the plugin to install
 * @param timeout - Timeout in milliseconds (unused)
 * @returns Installation result (always success/alreadyInstalled)
 */
export declare function installPluginViaCli(pluginName: string, timeout?: number, skillFilter?: string): Promise<PluginInstallResult>;
/**
 * Install multiple plugins via CLI
 *
 * @deprecated v1.0.535: No-op — plugins are pre-installed at init time.
 * @param plugins - Array of plugin names to install
 * @returns Array of installation results (all alreadyInstalled)
 */
export declare function installPluginsViaCli(plugins: string[], skillInvocation?: SkillInvocation): Promise<PluginInstallResult[]>;
/**
 * Full pipeline: detect plugins from prompt and optionally install them
 *
 * @deprecated v1.0.535: Plugin installation removed. Detection still works
 * for increment suggestions but no longer triggers installation.
 * All plugins are pre-installed at init time via direct file copy.
 *
 * @param userPrompt - The user's prompt
 * @returns Detection results (installations always empty)
 */
export declare function detectAndInstallPlugins(userPrompt: string): Promise<{
    detection: LLMDetectionResult;
    installations: PluginInstallResult[];
    suggestOnly?: boolean;
}>;
/**
 * Format hook output for Claude Code
 *
 * @param result - Detection/installation result
 * @returns JSON string for hook output
 */
export declare function formatHookOutput(result: {
    detection: LLMDetectionResult;
    installations: PluginInstallResult[];
    suggestOnly?: boolean;
}): string;
//# sourceMappingURL=llm-plugin-detector.d.ts.map