@hivetechs/hive-ai
Version:
Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API
348 lines (295 loc) โข 12.6 kB
JavaScript
/**
* Freemium Help Tool
* Provides clear guidance on subscription tiers, limits, and upgrade options
*/
import { z } from 'zod';
import { LicenseGate } from '../../core/license-gate.js';
export const freemiumHelpToolName = 'freemium_help';
export const freemiumHelpToolDescription = 'Get help with subscription plans, limits, and upgrade options';
export const FreemiumHelpSchema = z.object({
topic: z.enum(['overview', 'limits', 'plans', 'upgrade', 'credits', 'features']).default('overview').describe('Help topic to get information about')
});
export async function runFreemiumHelpTool(args) {
try {
const licenseGate = LicenseGate.getInstance();
const subscription = await licenseGate.getSubscriptionDetails();
let helpContent = '';
switch (args.topic) {
case 'overview':
helpContent = generateOverviewHelp(subscription);
break;
case 'limits':
helpContent = generateLimitsHelp(subscription);
break;
case 'plans':
helpContent = generatePlansHelp();
break;
case 'upgrade':
helpContent = generateUpgradeHelp(subscription);
break;
case 'credits':
helpContent = generateCreditsHelp();
break;
case 'features':
helpContent = generateFeaturesHelp(subscription);
break;
default:
helpContent = generateOverviewHelp(subscription);
}
return {
help_content: helpContent,
message: helpContent
};
}
catch (error) {
return {
error: `Failed to get help information: ${error instanceof Error ? error.message : 'Unknown error'}`,
message: 'โ **ERROR** - Unable to retrieve help information.'
};
}
}
function generateOverviewHelp(subscription) {
const currentTier = subscription.tier || 'free';
return `# ๐ Hive-Tools Freemium Guide
Welcome to hive-tools! You're currently on the **${currentTier.toUpperCase()}** tier.
## What is hive-tools?
Hive-tools provides AI-powered multi-model consensus that delivers 40% better responses than single models by combining insights from multiple AI providers.
## Your Current Plan
**${currentTier.charAt(0).toUpperCase() + currentTier.slice(1)} Tier**
- Daily Limit: ${subscription.daily_limit || 10} conversations (after trial)
- Monthly Limit: ${subscription.monthly_limit || 100} conversations
- Features: ${currentTier === 'free' ? 'Basic AI chat, provider management' : 'Full consensus pipeline, analytics, priority support'}
## Quick Commands
- \`usage_display\` - Check your usage status
- \`check_subscription\` - View subscription details
- \`upgrade_subscription\` - See upgrade options
- \`purchase_credits\` - Buy additional conversations
- \`freemium_help topic:plans\` - Compare all plans
## Need Help?
- Limits: \`freemium_help topic:limits\`
- Plans: \`freemium_help topic:plans\`
- Upgrade: \`freemium_help topic:upgrade\`
- Credits: \`freemium_help topic:credits\`
- Features: \`freemium_help topic:features\`
${currentTier === 'free' ? '๐ **Ready to unlock the full power?** Start your 7-day FREE trial with unlimited conversations!' : ''}`;
}
function generateLimitsHelp(subscription) {
const currentTier = subscription.tier || 'free';
return `# ๐ Understanding Your Limits
## Current Limits (${currentTier.toUpperCase()} tier)
- **Daily**: ${subscription.daily_limit || 10} conversations per day (after trial)
- **Monthly**: ${subscription.monthly_limit || 100} conversations per month
## How Limits Work
1. **Daily limits reset** every day at midnight (your local time)
2. **Monthly limits reset** on the 1st of each month
3. **Both limits** must be respected - hitting either one stops conversations
4. **Credits extend** your usage when you hit limits (premium feature)
## What Counts as a Conversation?
- Each use of \`consensus\` (premium) = 1 conversation
- Each use of \`single_model\` (free) = 1 conversation
- Configuration tools (providers, etc.) = 0 conversations
## When You Hit Limits
${currentTier === 'free' ?
'- **Free tier**: Conversations stop until limits reset\n- **Solution**: Upgrade to premium or wait for reset' :
'- **Premium tiers**: Can use bonus credits to continue\n- **Solution**: Upgrade tier or purchase additional credits'}
## Upgrade Options
${currentTier === 'free' ?
'- **7-day FREE trial**: Unlimited conversations\n- **Basic ($5/mo)**: 50 daily, 1,000 monthly\n- **Standard ($10/mo)**: 100 daily, 2,000 monthly\n- **Premium ($20/mo)**: 200 daily, 4,000 monthly' :
'See \`freemium_help topic:upgrade\` for your upgrade options'}
Use \`usage_display\` to check your current usage anytime!`;
}
function generatePlansHelp() {
return `# ๐ Subscription Plans Comparison
## Free Tier
**$0/month** - Perfect for trying hive-tools
- โ
Unlimited during trial, then 10 daily conversations
- โ
Basic AI chat (single models)
- โ
Provider configuration & testing
- โ Multi-model consensus pipeline
- โ Advanced analytics & benchmarking
- โ Priority support
## Basic Plan
**$5/month** - Great for regular users
- โ
50 daily, 1,000 monthly conversations
- โ
**Multi-model consensus pipeline**
- โ
**Advanced analytics & cost tracking**
- โ
**Performance benchmarking**
- โ
Standard support
- ๐ณ Bonus credits available
## Standard Plan
**$10/month** - Perfect for power users
- โ
100 daily, 2,000 monthly conversations
- โ
**All Basic features**
- โ
**Priority support**
- โ
**Advanced pipeline customization**
- ๐ณ More bonus credits included
## Premium Plan
**$20/month** - For heavy usage
- โ
200 daily, 4,000 monthly conversations
- โ
**All Standard features**
- โ
**Highest priority support**
- โ
**Beta features access**
- ๐ณ Maximum bonus credits
## Team Plan
**$50/month** - For organizations
- โ
600 daily, 12,000 monthly conversations
- โ
**All Premium features**
- โ
**Team management tools**
- โ
**Custom configurations**
- โ
**Dedicated support**
## ๐ฐ Save with Annual Billing
Pay yearly and get **2 months free** on any plan!
Start your upgrade: \`upgrade_subscription\``;
}
function generateUpgradeHelp(subscription) {
const currentTier = subscription.tier || 'free';
let content = `# ๐ Upgrade Your Plan
## Current Plan: ${currentTier.charAt(0).toUpperCase() + currentTier.slice(1)}
`;
if (currentTier === 'free') {
content += `## Why Upgrade?
1. **40% Better Responses** - Multi-model consensus beats single models
2. **More Conversations** - Up to 200 daily, 4,000 monthly
3. **Advanced Features** - Analytics, benchmarking, priority support
4. **No Interruptions** - Never hit conversation limits
## ๐ฏ Recommended: Start with 7-Day FREE Trial
- **Unlimited conversations** during trial
- **All premium features** unlocked
- **No commitment** - cancel anytime
- **Seamless transition** to paid plan after trial
## Quick Upgrade Steps
1. Run: \`upgrade_subscription tier:basic\`
2. Choose monthly or yearly billing
3. Complete payment via secure checkout
4. Start using premium features immediately!
## Payment Options
- **Monthly billing** - Pay as you go
- **Yearly billing** - Save 2 months (16% discount)
- **Secure checkout** via Gumroad
- **Instant activation** after payment`;
}
else {
const nextTiers = {
basic: 'Standard ($10/month)',
standard: 'Premium ($20/month)',
premium: 'Team ($50/month)',
team: null
};
const nextTier = nextTiers[currentTier];
if (nextTier) {
content += `## Next Tier: ${nextTier}
Upgrade to get:
- Higher conversation limits
- Additional premium features
- Enhanced support
- More bonus credits
Run: \`upgrade_subscription\` to see exact benefits and pricing.`;
}
else {
content += `## You're on the highest tier!
You have access to all premium features. Consider:
- **Bonus credits** for extra conversations: \`purchase_credits\`
- **Team features** if you need collaboration tools
- **Custom solutions** for enterprise needs`;
}
}
content += `
## Need Help Choosing?
- Compare plans: \`freemium_help topic:plans\`
- Check usage: \`usage_display\`
- View current subscription: \`check_subscription\`
Questions? Contact support at support@hivetechs.io`;
return content;
}
function generateCreditsHelp() {
return `# ๐ณ Bonus Credits System
## What are Credits?
Bonus credits let you continue conversations when you hit your daily or monthly limits.
## How Credits Work
1. **Used automatically** when you hit subscription limits
2. **Never expire** - they roll over each month
3. **1 credit = 1 conversation** beyond your limits
4. **Available on all paid plans** (not free tier)
## Credit Packs Available
### Starter Pack - $3
- **25 bonus credits**
- **12ยข per conversation**
- Perfect for occasional extra usage
### Value Pack - $7 โญ Most Popular
- **75 bonus credits**
- **9.3ยข per conversation** (22% savings)
- Great for regular heavy users
### Power Pack - $15
- **200 bonus credits**
- **7.5ยข per conversation** (37% savings)
- Best value for power users
## When to Buy Credits vs. Upgrade
- **Buy credits** if you occasionally need extra conversations
- **Upgrade plan** if you regularly hit limits
- **Credits stack** - you can buy multiple packs
## How to Purchase
1. Run: \`purchase_credits pack:value\` (or starter/power)
2. Choose quantity (1-10 packs)
3. Complete secure checkout
4. Credits added instantly to your account
## Check Your Credits
- \`usage_display\` - Shows remaining credits
- \`check_subscription detailed:true\` - Full account overview
## Credit Usage Tips
- Credits are used **only after** hitting daily/monthly limits
- They work with **any conversation tool** (consensus, single_model)
- **No expiration** - buy when convenient, use when needed
Start purchasing: \`purchase_credits\``;
}
function generateFeaturesHelp(subscription) {
const currentTier = subscription.tier || 'free';
const isFreeTier = currentTier === 'free';
return `# โจ Features Overview
## ${isFreeTier ? 'Free Tier Features (Current)' : `${currentTier.charAt(0).toUpperCase() + currentTier.slice(1)} Tier Features (Current)`}
### ${isFreeTier ? 'โ
' : 'โ
'} Available to You
- **Provider Management** - Configure OpenAI, Anthropic, Google, etc.
- **Single Model Queries** - Direct AI conversations with one model
- **Basic Configuration** - Set up your AI providers and test them
- **Account Management** - View usage, manage subscription
${isFreeTier ? '### โ Premium Features (Upgrade Required)' : '### โ
Premium Features (You Have Access)'}
- **๐ง Multi-Model Consensus Pipeline** - 40% better responses
- Generator โ Refiner โ Validator โ Curator stages
- Combines insights from multiple AI models
- Reduces hallucinations and improves accuracy
- **๐ Advanced Analytics**
- Detailed usage statistics and trends
- Cost tracking across providers
- Performance benchmarking
- **โ๏ธ Pipeline Customization**
- Custom pipeline profiles
- Model-specific configurations
- Temperature and parameter control
- **๐ฏ Knowledge Management**
- Conversation memory and context
- Topic-based knowledge retrieval
- Semantic search across past conversations
- **๐ณ Bonus Credits System**
- Continue conversations beyond limits
- Flexible credit packs
- Never-expiring credits
- **๐ Priority Support**
- Faster response times
- Direct access to technical team
- Feature request prioritization
## The Consensus Advantage
Traditional AI gives you one perspective. Hive-tools gives you the wisdom of crowds:
1. **Generator** creates initial response
2. **Refiner** improves depth and clarity
3. **Validator** ensures factual accuracy
4. **Curator** polishes final presentation
Result: **40% better responses** than single models alone.
## Ready to Upgrade?
${isFreeTier ?
'๐ **Start your 7-day FREE trial** with unlimited access!\n\nRun: `upgrade_subscription tier:basic`' :
'๐ฏ **You have full access** to all premium features!\n\nTry the consensus pipeline: `consensus prompt:"Your question here"`'}
## Learn More
- See all plans: \`freemium_help topic:plans\`
- Upgrade guide: \`freemium_help topic:upgrade\`
- Check usage: \`usage_display\``;
}
//# sourceMappingURL=freemium-help.js.map