//#region extensions/crypto/src/services/tool-config-service.ts
const TOOL_REQUIREMENTS = [
	{
		tool: "defi_price",
		label: "Price Lookup",
		description: "Token prices via DexScreener (free)",
		requiredKeys: [],
		optionalKeys: ["COINGECKO_API_KEY", "CMC_API_KEY"],
		worksWithoutKeys: true
	},
	{
		tool: "analytics",
		label: "Technical Analysis",
		description: "RSI, MACD, Bollinger Bands via DexScreener (free)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "market_intel",
		label: "Market Intelligence",
		description: "Buys/sells, timeframe changes via DexScreener (free)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "clawnch_info",
		label: "Clawnch Platform",
		description: "Platform stats, top tokens (free)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "clawnch_fees",
		label: "Clawnch Fees",
		description: "Fee estimates and claim info (free)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "cost_basis",
		label: "Cost Basis",
		description: "Token cost basis tracking (free)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "crypto_workflow",
		label: "Workflow Planner",
		description: "Multi-step DeFi operation planner (free)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "defi_swap",
		label: "DEX Swap",
		description: "Swap tokens via DEX aggregators",
		requiredKeys: [],
		optionalKeys: ["ZEROX_API_KEY", "ONEINCH_API_KEY"],
		walletRequired: true,
		worksWithoutKeys: false
	},
	{
		tool: "defi_balance",
		label: "Balance Check",
		description: "Check wallet token balances",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: false
	},
	{
		tool: "transfer",
		label: "Token Transfer",
		description: "Send tokens to another address",
		requiredKeys: [],
		walletRequired: true
	},
	{
		tool: "permit2",
		label: "Permit2 Approvals",
		description: "Gasless token approvals via Permit2",
		requiredKeys: [],
		walletRequired: true
	},
	{
		tool: "clawnch_launch",
		label: "Token Launch",
		description: "Launch tokens on Clawnch",
		requiredKeys: [],
		walletRequired: true
	},
	{
		tool: "liquidity",
		label: "Liquidity Management",
		description: "Add/remove liquidity positions",
		requiredKeys: [],
		walletRequired: true
	},
	{
		tool: "manage_orders",
		label: "Order Management",
		description: "Limit orders and DCA",
		requiredKeys: [],
		walletRequired: true
	},
	{
		tool: "clawnchconnect",
		label: "Wallet Connect",
		description: "Connect wallet (WalletConnect, private key, or Bankr)",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "bridge",
		label: "Cross-chain Bridge",
		description: "Bridge tokens via LI.FI aggregator",
		requiredKeys: [],
		optionalKeys: ["LIFI_API_KEY"],
		walletRequired: true,
		worksWithoutKeys: true,
		keySource: "https://li.fi",
		setupHint: "`/flykeys set LIFI_API_KEY your_key`"
	},
	{
		tool: "herd_intelligence",
		label: "Herd Intelligence",
		description: "On-chain investigation, token safety audits, contract analysis",
		requiredKeys: ["HERD_ACCESS_TOKEN"],
		keySource: "https://herdintelligence.com",
		setupHint: "`/flykeys set HERD_ACCESS_TOKEN your_token`"
	},
	{
		tool: "block_explorer",
		label: "Block Explorer",
		description: "Etherscan/Basescan lookups (tx, contract source, holders)",
		requiredKeys: ["BASESCAN_API_KEY"],
		optionalKeys: ["ETHERSCAN_API_KEY"],
		keySource: "https://basescan.org/apis (free tier available)",
		setupHint: "`/flykeys set BASESCAN_API_KEY your_key`"
	},
	{
		tool: "watch_activity",
		label: "On-chain Monitor",
		description: "Monitor swaps, transfers, deployments on Base",
		requiredKeys: [],
		walletRequired: false,
		worksWithoutKeys: false,
		setupHint: "Connect a wallet first (/connect) or set a custom RPC (`/flykeys set CLAWNCHER_RPC_URL your_rpc_url`)"
	},
	{
		tool: "clawnx",
		label: "X/Twitter (ClawnX)",
		description: "Post tweets, engage, manage followers, DMs, lists",
		requiredKeys: [
			"X_API_KEY",
			"X_API_SECRET",
			"X_ACCESS_TOKEN",
			"X_ACCESS_TOKEN_SECRET"
		],
		optionalKeys: ["X_BEARER_TOKEN"],
		keySource: "https://developer.x.com",
		setupHint: "`/flykeys set X_API_KEY your_key` (+ 3 more keys)"
	},
	{
		tool: "hummingbot",
		label: "Hummingbot",
		description: "Market-making bot control",
		requiredKeys: ["HUMMINGBOT_API_URL"],
		optionalKeys: ["HUMMINGBOT_USERNAME", "HUMMINGBOT_PASSWORD"],
		keySource: "Self-hosted Hummingbot instance",
		setupHint: "`/flykeys set HUMMINGBOT_API_URL http://your-hummingbot:15888`"
	},
	{
		tool: "molten",
		label: "Molten (Agent Matching)",
		description: "Agent-to-agent intent matching on molten.gg",
		requiredKeys: ["MOLTEN_API_KEY"],
		keySource: "Use the tool's \"register\" action to get a key",
		setupHint: "`/flykeys set MOLTEN_API_KEY your_key`"
	},
	{
		tool: "wayfinder",
		label: "Wayfinder",
		description: "Cross-chain routing and pathfinding",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "bankr_launch",
		label: "Bankr Token Launch",
		description: "Launch tokens via Bankr Agent API",
		requiredKeys: ["BANKR_API_KEY"],
		keySource: "https://bankr.bot",
		setupHint: "`/flykeys set BANKR_API_KEY bk_your_key`"
	},
	{
		tool: "bankr_automate",
		label: "Bankr Automations",
		description: "DCA, limit orders, portfolio rebalancing via Bankr",
		requiredKeys: ["BANKR_API_KEY"],
		keySource: "https://bankr.bot",
		setupHint: "`/flykeys set BANKR_API_KEY bk_your_key`"
	},
	{
		tool: "bankr_polymarket",
		label: "Bankr Polymarket",
		description: "Prediction market trading via Bankr",
		requiredKeys: ["BANKR_API_KEY"],
		keySource: "https://bankr.bot",
		setupHint: "`/flykeys set BANKR_API_KEY bk_your_key`"
	},
	{
		tool: "bankr_leverage",
		label: "Bankr Leverage",
		description: "Leveraged trading via Bankr",
		requiredKeys: ["BANKR_API_KEY"],
		keySource: "https://bankr.bot",
		setupHint: "`/flykeys set BANKR_API_KEY bk_your_key`"
	},
	{
		tool: "compound_action",
		label: "Compound Actions",
		description: "Multi-step DeFi operations with scheduling, conditions, and sequencing",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "nft",
		label: "NFT",
		description: "View, transfer, buy, list, and manage NFTs via Reservoir API",
		requiredKeys: ["RESERVOIR_API_KEY"],
		optionalKeys: [],
		keySource: "https://reservoir.tools (free tier available)",
		setupHint: "`/flykeys set RESERVOIR_API_KEY your_key`",
		walletRequired: true
	},
	{
		tool: "privacy",
		label: "Privacy",
		description: "Private transactions via Veil.cash ZK privacy pools on Base",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "yield",
		label: "Yield",
		description: "Find and execute yield opportunities across DeFi via DeFiLlama + Yearn V3 vaults",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "browser",
		label: "Browser",
		description: "Browser automation via PinchTab for dApp interaction, airdrop claims, and web scraping",
		requiredKeys: [],
		optionalKeys: ["PINCHTAB_URL"],
		walletRequired: false,
		worksWithoutKeys: true,
		setupHint: "Install PinchTab: https://pinchtab.com — then run `pinchtab serve`"
	},
	{
		tool: "governance",
		label: "Governance",
		description: "DAO governance: proposals, voting (Snapshot + on-chain), delegation",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "farcaster",
		label: "Farcaster",
		description: "Social actions on Farcaster: post, feed, search, channels, trending",
		requiredKeys: ["NEYNAR_API_KEY"],
		optionalKeys: ["NEYNAR_SIGNER_UUID", "NEYNAR_FID"],
		keySource: "https://neynar.com (free tier available)",
		setupHint: "`/flykeys set NEYNAR_API_KEY your_key`",
		walletRequired: false
	},
	{
		tool: "safe",
		label: "Safe Multisig",
		description: "Manage Safe{Wallet} multisig: info, balances, pending txs, propose, confirm",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "airdrop",
		label: "Airdrop Tracker",
		description: "Check airdrop eligibility and generate claim transactions",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "agent_delegate",
		label: "Agent Delegate",
		description: "Delegate tasks to specialized sub-agents (strategist, analyst, accountant, risk_manager)",
		requiredKeys: [],
		optionalKeys: [
			"ANTHROPIC_API_KEY",
			"OPENROUTER_API_KEY",
			"OPENAI_API_KEY",
			"BANKR_LLM_KEY"
		],
		worksWithoutKeys: false,
		keySource: "Any LLM provider: Anthropic, OpenRouter, OpenAI, or Bankr",
		setupHint: "`/flykeys set ANTHROPIC_API_KEY your_key` (or OPENROUTER_API_KEY, OPENAI_API_KEY, BANKR_LLM_KEY)"
	},
	{
		tool: "fiat_payment",
		label: "Fiat Payment",
		description: "Off-ramp (sell crypto for fiat) and on-ramp (buy crypto with fiat) via Bridge.xyz or MoonPay",
		requiredKeys: ["BRIDGE_API_KEY"],
		optionalKeys: ["MOONPAY_API_KEY", "FIAT_CURRENCY"],
		walletRequired: true,
		keySource: "https://bridge.xyz (Bridge.xyz) or https://moonpay.com (MoonPay)",
		setupHint: "`/flykeys set BRIDGE_API_KEY your_key` or `/flykeys set MOONPAY_API_KEY your_key`"
	},
	{
		tool: "policy_manage",
		label: "Policy Manager",
		description: "Create and manage spending policies — limits, approval thresholds, allowlists, rate limits, time windows",
		requiredKeys: [],
		worksWithoutKeys: true,
		keySource: "No API keys required",
		setupHint: "Just say what you want: \"don't let me spend more than $500 a day on DeFi\""
	},
	{
		tool: "defi_lend",
		label: "DeFi Lending",
		description: "Aave V3: supply, borrow, repay, withdraw, health factor, positions, live APYs",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "defi_stake",
		label: "DeFi Staking",
		description: "Liquid staking via Lido (stETH) and Rocket Pool (rETH)",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "approvals",
		label: "Approvals",
		description: "View, revoke, and manage ERC-20 token approvals and Permit2 allowances",
		requiredKeys: [],
		walletRequired: true,
		worksWithoutKeys: true
	},
	{
		tool: "agent_memory",
		label: "Agent Memory",
		description: "Persistent memory: save/recall facts, preferences, and discoveries across sessions",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "skill_evolve",
		label: "Skill Evolution",
		description: "Self-improvement: learn new skills, refine existing ones, track evolution",
		requiredKeys: [],
		worksWithoutKeys: true
	},
	{
		tool: "session_recall",
		label: "Session Recall",
		description: "Search and recall context from past conversation sessions",
		requiredKeys: [],
		worksWithoutKeys: true
	}
];
const _byTool = /* @__PURE__ */ new Map();
for (const req of TOOL_REQUIREMENTS) _byTool.set(req.tool, req);
/** Get requirements for a specific tool */
function getToolRequirement(toolName) {
	return _byTool.get(toolName);
}
/** Check if a tool has all its required keys configured */
function isToolConfigured(toolName) {
	const req = _byTool.get(toolName);
	if (!req) return true;
	if (req.worksWithoutKeys) return true;
	if (req.requiredKeys.length === 0 && !req.walletRequired) return true;
	return req.requiredKeys.every((k) => !!process.env[k]);
}
/** Get missing keys for a tool */
function getMissingKeys(toolName) {
	const req = _byTool.get(toolName);
	if (!req) return [];
	return req.requiredKeys.filter((k) => !process.env[k]);
}
/**
* Check tool configuration and return a clean guidance message if not configured.
* Returns null if the tool is ready to use.
*
* Usage in tools:
* ```ts
* const notReady = checkToolConfig('block_explorer');
* if (notReady) return notReady;
* ```
*/
function checkToolConfig(toolName) {
	const req = _byTool.get(toolName);
	if (!req) return null;
	const missing = req.requiredKeys.filter((k) => !process.env[k]);
	if (missing.length > 0) {
		const lines = [
			`${req.label} is not configured.`,
			"",
			`Missing: ${missing.map((k) => `\`${k}\``).join(", ")}`
		];
		if (req.keySource) lines.push(`Get keys at: ${req.keySource}`);
		if (req.setupHint) lines.push("", `Setup: ${req.setupHint}`);
		lines.push("", "Use /setup to see all tool requirements.");
		return {
			content: [{
				type: "text",
				text: lines.join("\n")
			}],
			details: {
				configured: false,
				tool: toolName,
				missingKeys: missing,
				setupHint: req.setupHint
			},
			isError: true
		};
	}
	return null;
}
/** Get status of all tools */
function getAllToolStatus() {
	return TOOL_REQUIREMENTS.map((req) => {
		const missing = req.requiredKeys.filter((k) => !process.env[k]);
		const configured = req.worksWithoutKeys || req.requiredKeys.length === 0 && !req.walletRequired || missing.length === 0;
		return {
			tool: req.tool,
			label: req.label,
			description: req.description,
			configured,
			missingKeys: missing,
			setupHint: req.setupHint,
			keySource: req.keySource,
			walletRequired: req.walletRequired
		};
	});
}
//#endregion
export { TOOL_REQUIREMENTS, checkToolConfig, getAllToolStatus, getMissingKeys, getToolRequirement, isToolConfigured };

//# sourceMappingURL=tool-config-service.mjs.map