behemoth-cli
Version:
🌍 BEHEMOTH CLIv3.760.4 - Level 50+ POST-SINGULARITY Intelligence Trading AI
398 lines • 13.3 kB
JavaScript
/**
* Fr3kCrypto Response Templates - CLI
* Pre-built templates for common tool response types
* Ensures no fallback data is used.
*/
import { EMOJI_MAPPINGS } from './formatter-types.js';
export class Fr3kTemplates {
/**
* Price Analysis Template
*/
static price(params) {
const data = [
{ key: 'Current Price', value: params.price, format: 'price' },
];
if (params.change !== undefined) {
data.push({
key: '24h Change',
value: params.change,
format: 'percentage',
color: params.change >= 0 ? 'bull' : 'bear',
});
}
if (params.high !== undefined) {
data.push({ key: '24h High', value: params.high, format: 'price' });
}
if (params.low !== undefined) {
data.push({ key: '24h Low', value: params.low, format: 'price' });
}
if (params.volume) {
data.push({ key: '24h Volume', value: params.volume, format: 'volume' });
}
if (params.marketCap) {
data.push({ key: 'Market Cap', value: params.marketCap, format: 'volume' });
}
return {
type: 'price',
header: {
emoji: EMOJI_MAPPINGS.price,
title: `${params.symbol} Live Analysis`,
color: 'primary',
},
sections: [{ data }],
footer: { source: params.source },
timestamp: new Date(),
metadata: { symbol: params.symbol, exchange: params.source }
};
}
/**
* Technical Analysis Template
*/
static technical(params) {
const indicatorData = params.indicators.map(indicator => {
const colorSignal = indicator.signal?.toLowerCase();
let color = 'neutral';
if (colorSignal?.includes('buy') || colorSignal?.includes('bullish'))
color = 'bull';
if (colorSignal?.includes('sell') || colorSignal?.includes('bearish'))
color = 'bear';
return { key: indicator.name, value: indicator.value, color };
});
const sections = [{
title: 'Technical Indicators',
data: indicatorData
}];
if (params.recommendation) {
let recColor = 'warning';
if (params.recommendation.toLowerCase().includes('buy'))
recColor = 'bull';
if (params.recommendation.toLowerCase().includes('sell'))
recColor = 'bear';
sections.push({
title: 'Recommendation',
data: [{
key: 'Signal',
value: params.recommendation,
color: recColor
}]
});
}
return {
type: 'technical',
header: {
emoji: EMOJI_MAPPINGS.technical,
title: `${params.symbol} Technical Analysis`,
color: 'primary',
},
sections,
footer: { source: params.source },
timestamp: new Date(),
metadata: { symbol: params.symbol }
};
}
/**
* Memecoin/Token Scanner Template
*/
static scan(params) {
const tokenData = params.tokens.map((token, index) => {
let displayValue = '';
if (token.hypeScore) {
displayValue = `Hype: ${token.hypeScore}%`;
}
else if (token.change !== undefined) {
displayValue = `${token.change >= 0 ? '+' : ''}${token.change.toFixed(2)}%`;
}
if (token.price) {
displayValue += ` (${token.price.toLocaleString()})`;
}
let color = 'accent';
if (token.change) {
color = token.change >= 0 ? 'bull' : 'bear';
}
return {
key: `${token.rank ? `#${token.rank} ` : ''}${token.name}${token.symbol ? ` (${token.symbol})` : ''}`,
value: displayValue,
color: color
};
});
return {
type: 'scan',
header: {
emoji: EMOJI_MAPPINGS.scan,
title: `Live ${params.scanType}`,
color: 'primary',
},
sections: [{
title: `Found ${params.tokens.length} trending tokens:`,
data: tokenData
}],
footer: { source: params.source },
timestamp: new Date()
};
}
/**
* Fear & Greed / Sentiment Template
*/
static sentiment(params) {
let levelColor = 'neutral';
if (params.level.toLowerCase().includes('greed'))
levelColor = 'bear';
if (params.level.toLowerCase().includes('fear'))
levelColor = 'bull';
const data = [
{
key: 'Current Level',
value: `${params.value} (${params.level})`,
color: levelColor
}
];
if (params.previous) {
data.push({
key: 'Previous',
value: params.previous,
format: 'number'
});
}
const sections = [{ title: 'Sentiment Analysis', data }];
if (params.analysis) {
sections.push({
title: 'Analysis',
content: params.analysis
});
}
return {
type: 'sentiment',
header: {
emoji: EMOJI_MAPPINGS.sentiment,
title: `Live ${params.metric}`,
color: 'primary'
},
sections,
footer: { source: params.source },
timestamp: new Date()
};
}
/**
* Whale Tracking Template
*/
static whale(params) {
const movementData = params.movements.map((movement) => {
let color = 'neutral';
if (movement.type === 'BUY')
color = 'bull';
if (movement.type === 'SELL')
color = 'bear';
return {
key: `• ${movement.type}`,
value: `${movement.amount}${movement.address ? ` (${movement.address.slice(0, 8)}...${movement.address.slice(-3)})` : ''}`,
color: color
};
});
const sections = [
{
title: 'Recent Movements',
data: movementData
}
];
if (params.totalVolume) {
sections.push({
title: 'Total Volume',
data: [{
key: 'Total Volume',
value: params.totalVolume,
format: 'volume',
color: 'accent'
}]
});
}
return {
type: 'whale',
header: {
emoji: EMOJI_MAPPINGS.whale,
title: `Live Whale Tracking (${params.timeframe})`,
color: 'primary'
},
sections,
footer: { source: params.source },
timestamp: new Date()
};
}
/**
* Portfolio/Strategy Template
*/
static strategy(params) {
const allocationData = Object.entries(params.allocation).map(([asset, percent]) => ({
key: `• ${asset}`,
value: `${percent}%`,
color: 'accent'
}));
const sections = [
{
title: 'Recommended Allocation',
data: allocationData
}
];
if (params.rules && params.rules.length > 0) {
sections.push({
title: 'Risk Management',
data: params.rules.map(rule => ({ key: '•', value: rule, color: 'neutral' }))
});
}
if (params.expectedReturn) {
sections.push({
title: 'Expected Return',
data: [{ key: 'Expected Return', value: params.expectedReturn, color: 'bull' }]
});
}
if (params.tips && params.tips.length > 0) {
sections.push({
title: 'Pro Tips',
data: params.tips.map(tip => ({ key: '💡', value: tip, color: 'warning' }))
});
}
return {
type: 'strategy',
header: {
emoji: EMOJI_MAPPINGS.strategy,
title: params.title,
color: 'primary'
},
sections,
footer: { source: params.source },
timestamp: new Date(),
metadata: { risk: params.riskLevel?.toLowerCase() }
};
}
/**
* Rugpull/Security Scan Template
*/
static security(params) {
let riskColor = 'bull';
let riskLevel = 'LOW';
if (params.riskScore >= 70) {
riskColor = 'bear';
riskLevel = 'EXTREME';
}
else if (params.riskScore >= 50) {
riskColor = 'bear';
riskLevel = 'HIGH';
}
else if (params.riskScore >= 30) {
riskColor = 'warning';
riskLevel = 'MEDIUM';
}
const sections = [
{
title: 'Risk Assessment',
data: [
{
key: 'Risk Score',
value: `${params.riskScore}/100 (${riskLevel})`,
color: riskColor,
suffix: params.riskScore >= 50 ? ' ⚠️' : undefined
}
]
}
];
if (params.flags && params.flags.length > 0) {
sections.push({
title: 'Red Flags',
data: [{ key: 'Issues', value: params.flags.join(', '), color: 'bear' }]
});
}
if (params.recommendation) {
sections.push({
title: 'Recommendation',
data: [{ key: 'Recommendation', value: params.recommendation, color: 'warning' }]
});
}
return {
type: 'scan',
header: {
emoji: '🛡️',
title: `${params.symbol} Security Scan`,
color: 'primary'
},
sections,
footer: { source: params.source },
timestamp: new Date(),
metadata: { symbol: params.symbol, risk: riskLevel.toLowerCase() }
};
}
/**
* Market Overview Template
*/
static market(params) {
const data = [
{ key: '• Total Market Cap', value: params.marketCap, format: 'volume' },
{ key: '• 24h Volume', value: params.volume24h, format: 'volume' },
{ key: '• BTC Dominance', value: `${params.btcDominance}%`, color: 'accent' },
];
if (params.activeCurrencies) {
data.push({ key: '• Active Coins', value: params.activeCurrencies.toLocaleString(), format: 'number' });
}
if (params.markets) {
data.push({ key: '• Markets', value: params.markets.toLocaleString(), format: 'number' });
}
const sections = [{ title: 'Market Statistics', data }];
if (params.sentiment) {
let sentColor = 'neutral';
if (params.sentiment.toLowerCase().includes('bullish'))
sentColor = 'bull';
if (params.sentiment.toLowerCase().includes('bearish'))
sentColor = 'bear';
sections.push({
title: 'Market Sentiment',
data: [{
key: 'Sentiment',
value: params.sentiment,
color: sentColor
}]
});
}
if (params.defiTvl) {
sections.push({
title: 'DeFi TVL',
data: [{ key: 'DeFi TVL', value: params.defiTvl, color: 'cosmic' }]
});
}
return {
type: 'list',
header: {
emoji: '📊',
title: 'Crypto Market Overview',
color: 'primary'
},
sections,
footer: { source: params.source },
timestamp: new Date()
};
}
/**
* Default Template for unhandled tool outputs
*/
static default(params) {
const sections = [
{
title: 'Tool Arguments',
data: Object.entries(params.toolArgs).map(([key, value]) => ({ key, value: JSON.stringify(value) }))
},
{
title: 'Tool Result',
content: JSON.stringify(params.result, null, 2)
}
];
return {
type: 'default',
header: {
emoji: '⚙️',
title: `Tool: ${params.toolName}`,
color: 'neutral'
},
sections,
footer: { source: 'Tool Execution' },
timestamp: new Date()
};
}
}
//# sourceMappingURL=formatter-templates.js.map