/**
 * @license
 * Copyright 2025 HopCode Team
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * Contextual tip registry — defines tips, their conditions, and display rules.
 */
import { DEFAULT_TOKEN_LIMIT } from '@hoptrendy/hopcode-core';
export function getContextUsagePercent(ctx) {
    const windowSize = ctx.contextWindowSize || DEFAULT_TOKEN_LIMIT;
    return (ctx.lastPromptTokenCount / windowSize) * 100;
}
export const tipRegistry = [
    // --- Post-response contextual tips (priority: higher = more urgent) ---
    {
        id: 'context-critical',
        content: 'Context is almost full! Run /compress now or start /new to continue.',
        trigger: 'post-response',
        isRelevant: (ctx) => getContextUsagePercent(ctx) >= 95,
        cooldownPrompts: 3,
        priority: 100,
    },
    {
        id: 'context-high',
        content: 'Context is getting full. Use /compress to free up space.',
        trigger: 'post-response',
        isRelevant: (ctx) => {
            const pct = getContextUsagePercent(ctx);
            return pct >= 80 && pct < 95;
        },
        cooldownPrompts: 5,
        priority: 90,
    },
    {
        id: 'compress-intro',
        content: 'Long conversation? /compress summarizes history to free context.',
        trigger: 'post-response',
        isRelevant: (ctx) => {
            const pct = getContextUsagePercent(ctx);
            return pct >= 50 && pct < 80 && ctx.sessionPromptCount > 5;
        },
        cooldownPrompts: 10,
        priority: 50,
    },
    // --- Startup tips ---
    {
        id: 'new-user-slash',
        content: 'Type / to open the command popup; Tab autocompletes slash commands and saved prompts.',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.sessionCount < 5,
        cooldownPrompts: 0,
        priority: 70,
    },
    {
        id: 'new-user-hopcodeMd',
        content: 'Add a HOPCODE.md file to give HopCode persistent project context.',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.sessionCount < 10,
        cooldownPrompts: 0,
        priority: 70,
    },
    {
        id: 'new-user-resume',
        content: 'You can resume a previous conversation by running hopcode --continue or hopcode --resume.',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.sessionCount < 10,
        cooldownPrompts: 0,
        priority: 70,
    },
    {
        id: 'shell-commands',
        content: 'You can run any shell commands from HopCode using ! (e.g. !ls).',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.sessionCount < 15,
        cooldownPrompts: 0,
        priority: 70,
    },
    {
        id: 'compress-startup',
        content: 'Use /compress when the conversation gets long to summarize history and free up context.',
        trigger: 'startup',
        isRelevant: () => true,
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'approval-mode-win32',
        content: 'You can switch permission mode quickly with Tab or /approval-mode.',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.platform === 'win32',
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'approval-mode',
        content: 'You can switch permission mode quickly with Shift+Tab or /approval-mode.',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.platform !== 'win32',
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'insight-command',
        content: 'Try /insight to generate personalized insights from your chat history.',
        trigger: 'startup',
        isRelevant: (ctx) => ctx.sessionCount > 20,
        cooldownPrompts: 0,
        priority: 70,
    },
    {
        id: 'btw-command',
        content: 'Use /btw to ask a quick side question without disrupting the conversation.',
        trigger: 'startup',
        isRelevant: () => true,
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'clear-new',
        content: 'Start a fresh idea with /clear or /new; the previous session stays available in history.',
        trigger: 'startup',
        isRelevant: () => true,
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'bug-report',
        content: 'Use /bug to submit issues to the maintainers when something goes off.',
        trigger: 'startup',
        isRelevant: () => true,
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'auth-switch',
        content: 'Switch auth type quickly with /auth.',
        trigger: 'startup',
        isRelevant: () => true,
        cooldownPrompts: 0,
        priority: 50,
    },
    {
        id: 'compact-mode',
        content: 'Press Ctrl+O to toggle compact mode — hide tool output and thinking for a cleaner view.',
        trigger: 'startup',
        isRelevant: () => true,
        cooldownPrompts: 0,
        priority: 50,
    },
];
//# sourceMappingURL=tipRegistry.js.map