hybrid 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/tools/index.ts","../../src/tools/blockchain.ts","../../src/core/tool.ts","../../src/tools/xmtp.ts"],"sourcesContent":["/**\n * @fileoverview Hybrid Agent Tools Standard Library\n *\n * This module provides a comprehensive set of tools for building crypto-enabled agents.\n * Tools are organized by category and can be imported individually or as complete sets.\n *\n * @example\n * ```typescript\n * import { blockchainTools, xmtpTools } from \"hybrid/tools\"\n * import { Agent } from \"hybrid\"\n *\n * const agent = new Agent({\n * name: \"crypto-agent\",\n * model: myModel,\n * tools: {\n * ...blockchainTools,\n * ...xmtpTools\n * },\n * instructions: \"You are a crypto agent with blockchain and messaging capabilities.\",\n * createRuntime: (runtime) => ({\n * rpcUrl: process.env.RPC_URL,\n * privateKey: process.env.PRIVATE_KEY,\n * defaultChain: \"mainnet\" as const\n * })\n * })\n * ```\n *\n * @module HybridTools\n */\n\n// Export blockchain tools\nexport {\n\tblockchainTools,\n\testimateGasTool,\n\tgetBalanceTool,\n\tgetBlockTool,\n\tgetGasPriceTool,\n\tgetTransactionTool,\n\tsendTransactionTool,\n\ttype BlockchainRuntimeExtension\n} from \"./blockchain\"\n\n// Export XMTP tools\nexport {\n\tgetMessageTool,\n\tsendMessageTool,\n\tsendReactionTool,\n\tsendReplyTool,\n\txmtpTools\n} from \"./xmtp\"\n","/**\n * @fileoverview Blockchain Tools for Crypto Agents\n *\n * This module provides comprehensive blockchain interaction tools for crypto-enabled agents.\n * Supports Ethereum and other EVM-compatible chains with features like balance checking,\n * transaction sending, contract interaction, and more.\n *\n * @module BlockchainTools\n */\n\nimport {\n\tcreatePublicClient,\n\tcreateWalletClient,\n\tformatEther,\n\thttp,\n\tparseEther,\n\ttype Address,\n\ttype Hash\n} from \"viem\"\nimport { privateKeyToAccount } from \"viem/accounts\"\nimport {\n\tarbitrum,\n\tbase,\n\tmainnet,\n\toptimism,\n\tpolygon,\n\tsepolia\n} from \"viem/chains\"\nimport { z } from \"zod\"\nimport { createTool } from \"../core/tool\"\n\n// Supported chains configuration\nconst SUPPORTED_CHAINS = {\n\tmainnet,\n\tsepolia,\n\tpolygon,\n\tarbitrum,\n\toptimism,\n\tbase\n} as const\n\ntype SupportedChain = keyof typeof SUPPORTED_CHAINS\n\n// Runtime extension interface for blockchain tools\nexport interface BlockchainRuntimeExtension {\n\trpcUrl?: string\n\tprivateKey?: string\n\tdefaultChain?: SupportedChain\n}\n\n/**\n * Get Balance Tool\n *\n * Retrieves the native token balance for a given address on a specified chain.\n *\n * @tool getBalance\n * @category Blockchain\n *\n * @param {string} address - The wallet address to check balance for\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, balance: string, balanceWei: string, address: string, chain: string, error?: string}>}\n */\nexport const getBalanceTool = createTool({\n\tid: \"getBalance\",\n\tdescription:\n\t\t\"Get the native token balance for a wallet address on a blockchain\",\n\tinputSchema: z.object({\n\t\taddress: z.string().describe(\"The wallet address to check balance for\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tbalance: z\n\t\t\t.string()\n\t\t\t.describe(\"Balance in human readable format (ETH, MATIC, etc.)\"),\n\t\tbalanceWei: z.string().describe(\"Balance in wei (smallest unit)\"),\n\t\taddress: z.string(),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { address, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\t// Use runtime RPC URL if provided, otherwise use default\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(`🔍 [getBalance] Checking balance for ${address} on ${chain}`)\n\n\t\t\tconst balanceWei = await client.getBalance({\n\t\t\t\taddress: address as Address\n\t\t\t})\n\n\t\t\tconst balance = formatEther(balanceWei)\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getBalance] Balance: ${balance} ${chainConfig.nativeCurrency.symbol}`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tbalance: `${balance} ${chainConfig.nativeCurrency.symbol}`,\n\t\t\t\tbalanceWei: balanceWei.toString(),\n\t\t\t\taddress,\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getBalance] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tbalance: \"0\",\n\t\t\t\tbalanceWei: \"0\",\n\t\t\t\taddress: input.address,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Transaction Tool\n *\n * Retrieves transaction details by transaction hash.\n *\n * @tool getTransaction\n * @category Blockchain\n *\n * @param {string} hash - The transaction hash to look up\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, transaction?: object, error?: string}>}\n */\nexport const getTransactionTool = createTool({\n\tid: \"getTransaction\",\n\tdescription: \"Get transaction details by transaction hash\",\n\tinputSchema: z.object({\n\t\thash: z.string().describe(\"The transaction hash to look up\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\ttransaction: z\n\t\t\t.object({\n\t\t\t\thash: z.string(),\n\t\t\t\tfrom: z.string(),\n\t\t\t\tto: z.string().nullable(),\n\t\t\t\tvalue: z.string(),\n\t\t\t\tgasUsed: z.string().optional(),\n\t\t\t\tgasPrice: z.string().optional(),\n\t\t\t\tblockNumber: z.string().optional(),\n\t\t\t\tstatus: z.string().optional()\n\t\t\t})\n\t\t\t.optional(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { hash, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`🔍 [getTransaction] Looking up transaction ${hash} on ${chain}`\n\t\t\t)\n\n\t\t\tconst transaction = await client.getTransaction({\n\t\t\t\thash: hash as Hash\n\t\t\t})\n\n\t\t\tconst receipt = await client\n\t\t\t\t.getTransactionReceipt({\n\t\t\t\t\thash: hash as Hash\n\t\t\t\t})\n\t\t\t\t.catch(() => null) // Transaction might be pending\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getTransaction] Found transaction from ${transaction.from} to ${transaction.to}`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\ttransaction: {\n\t\t\t\t\thash: transaction.hash,\n\t\t\t\t\tfrom: transaction.from,\n\t\t\t\t\tto: transaction.to,\n\t\t\t\t\tvalue: formatEther(transaction.value),\n\t\t\t\t\tgasUsed: receipt?.gasUsed.toString(),\n\t\t\t\t\tgasPrice: transaction.gasPrice?.toString(),\n\t\t\t\t\tblockNumber: transaction.blockNumber?.toString(),\n\t\t\t\t\tstatus:\n\t\t\t\t\t\treceipt?.status === \"success\"\n\t\t\t\t\t\t\t? \"success\"\n\t\t\t\t\t\t\t: receipt?.status === \"reverted\"\n\t\t\t\t\t\t\t\t? \"failed\"\n\t\t\t\t\t\t\t\t: \"pending\"\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getTransaction] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Send Transaction Tool\n *\n * Sends a native token transaction to another address.\n * Requires a private key to be configured in the runtime.\n *\n * @tool sendTransaction\n * @category Blockchain\n *\n * @param {string} to - The recipient address\n * @param {string} amount - The amount to send (in ETH, MATIC, etc.)\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, hash?: string, error?: string}>}\n */\nexport const sendTransactionTool = createTool({\n\tid: \"sendTransaction\",\n\tdescription: \"Send native tokens to another address\",\n\tinputSchema: z.object({\n\t\tto: z.string().describe(\"The recipient address\"),\n\t\tamount: z.string().describe(\"The amount to send (in ETH, MATIC, etc.)\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to send on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\thash: z.string().optional(),\n\t\tfrom: z.string().optional(),\n\t\tto: z.string(),\n\t\tamount: z.string(),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { to, amount, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst privateKey = (runtime as any).privateKey\n\t\t\tif (!privateKey) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tto,\n\t\t\t\t\tamount,\n\t\t\t\t\tchain,\n\t\t\t\t\terror: \"Private key not configured in runtime\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\t\t\tconst account = privateKeyToAccount(privateKey as `0x${string}`)\n\n\t\t\tconst client = createWalletClient({\n\t\t\t\taccount,\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`💸 [sendTransaction] Sending ${amount} ${chainConfig.nativeCurrency.symbol} to ${to} on ${chain}`\n\t\t\t)\n\n\t\t\tconst hash = await client.sendTransaction({\n\t\t\t\tto: to as Address,\n\t\t\t\tvalue: parseEther(amount)\n\t\t\t})\n\n\t\t\tconsole.log(`✅ [sendTransaction] Transaction sent: ${hash}`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\thash,\n\t\t\t\tfrom: account.address,\n\t\t\t\tto,\n\t\t\t\tamount,\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendTransaction] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tto: input.to,\n\t\t\t\tamount: input.amount,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Block Tool\n *\n * Retrieves information about a specific block.\n *\n * @tool getBlock\n * @category Blockchain\n *\n * @param {string} [blockNumber] - Block number (defaults to latest)\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, block?: object, error?: string}>}\n */\nexport const getBlockTool = createTool({\n\tid: \"getBlock\",\n\tdescription: \"Get information about a blockchain block\",\n\tinputSchema: z.object({\n\t\tblockNumber: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\"Block number (defaults to latest)\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tblock: z\n\t\t\t.object({\n\t\t\t\tnumber: z.string(),\n\t\t\t\thash: z.string(),\n\t\t\t\ttimestamp: z.string(),\n\t\t\t\ttransactionCount: z.number(),\n\t\t\t\tgasUsed: z.string(),\n\t\t\t\tgasLimit: z.string()\n\t\t\t})\n\t\t\t.optional(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { blockNumber, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`🔍 [getBlock] Getting block ${blockNumber || \"latest\"} on ${chain}`\n\t\t\t)\n\n\t\t\tconst block = await client.getBlock({\n\t\t\t\tblockNumber: blockNumber ? BigInt(blockNumber) : undefined\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getBlock] Found block ${block.number} with ${block.transactions.length} transactions`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tblock: {\n\t\t\t\t\tnumber: block.number.toString(),\n\t\t\t\t\thash: block.hash,\n\t\t\t\t\ttimestamp: block.timestamp.toString(),\n\t\t\t\t\ttransactionCount: block.transactions.length,\n\t\t\t\t\tgasUsed: block.gasUsed.toString(),\n\t\t\t\t\tgasLimit: block.gasLimit.toString()\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getBlock] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Gas Price Tool\n *\n * Retrieves current gas price information for a blockchain.\n *\n * @tool getGasPrice\n * @category Blockchain\n *\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, gasPrice?: string, error?: string}>}\n */\nexport const getGasPriceTool = createTool({\n\tid: \"getGasPrice\",\n\tdescription: \"Get current gas price for a blockchain\",\n\tinputSchema: z.object({\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tgasPrice: z.string().optional().describe(\"Gas price in gwei\"),\n\t\tgasPriceWei: z.string().optional().describe(\"Gas price in wei\"),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(`â›Ŋ [getGasPrice] Getting gas price for ${chain}`)\n\n\t\t\tconst gasPrice = await client.getGasPrice()\n\t\t\tconst gasPriceGwei = formatEther(gasPrice * BigInt(1000000000)) // Convert to gwei\n\n\t\t\tconsole.log(`✅ [getGasPrice] Current gas price: ${gasPriceGwei} gwei`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tgasPrice: `${gasPriceGwei} gwei`,\n\t\t\t\tgasPriceWei: gasPrice.toString(),\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getGasPrice] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Estimate Gas Tool\n *\n * Estimates gas required for a transaction.\n *\n * @tool estimateGas\n * @category Blockchain\n *\n * @param {string} to - The recipient address\n * @param {string} [amount] - The amount to send (defaults to 0)\n * @param {string} [data] - Transaction data (for contract calls)\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, gasEstimate?: string, error?: string}>}\n */\nexport const estimateGasTool = createTool({\n\tid: \"estimateGas\",\n\tdescription: \"Estimate gas required for a transaction\",\n\tinputSchema: z.object({\n\t\tto: z.string().describe(\"The recipient address\"),\n\t\tamount: z\n\t\t\t.string()\n\t\t\t.default(\"0\")\n\t\t\t.describe(\"The amount to send (defaults to 0)\"),\n\t\tdata: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\"Transaction data (for contract calls)\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to estimate on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tgasEstimate: z.string().optional(),\n\t\tto: z.string(),\n\t\tamount: z.string(),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { to, amount, data, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst privateKey = (runtime as any).privateKey\n\t\t\tif (!privateKey) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tto,\n\t\t\t\t\tamount,\n\t\t\t\t\tchain,\n\t\t\t\t\terror: \"Private key not configured in runtime\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\t\t\tconst account = privateKeyToAccount(privateKey as `0x${string}`)\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`â›Ŋ [estimateGas] Estimating gas for transaction to ${to} on ${chain}`\n\t\t\t)\n\n\t\t\tconst gasEstimate = await client.estimateGas({\n\t\t\t\taccount: account.address,\n\t\t\t\tto: to as Address,\n\t\t\t\tvalue: parseEther(amount),\n\t\t\t\tdata: data as `0x${string}` | undefined\n\t\t\t})\n\n\t\t\tconsole.log(`✅ [estimateGas] Estimated gas: ${gasEstimate.toString()}`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tgasEstimate: gasEstimate.toString(),\n\t\t\t\tto,\n\t\t\t\tamount,\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [estimateGas] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tto: input.to,\n\t\t\t\tamount: input.amount,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Collection of blockchain tools for crypto agents\n *\n * These tools provide comprehensive blockchain interaction capabilities including\n * balance checking, transaction sending, gas estimation, and more.\n *\n * @namespace blockchainTools\n *\n * @property {Tool} getBalance - Get native token balance for an address\n * @property {Tool} getTransaction - Get transaction details by hash\n * @property {Tool} sendTransaction - Send native tokens to another address\n * @property {Tool} getBlock - Get information about a blockchain block\n * @property {Tool} getGasPrice - Get current gas price for a blockchain\n * @property {Tool} estimateGas - Estimate gas required for a transaction\n */\nexport const blockchainTools = {\n\tgetBalance: getBalanceTool,\n\tgetTransaction: getTransactionTool,\n\tsendTransaction: sendTransactionTool,\n\tgetBlock: getBlockTool,\n\tgetGasPrice: getGasPriceTool,\n\testimateGas: estimateGasTool\n}\n","import { Tool as AISDKTool, type UIMessage } from \"ai\"\nimport { z } from \"zod\"\nimport { AgentRuntime } from \"../types\"\n\ntype DefaultRuntimeExtension = Record<string, never>\n\n/**\n * Configuration interface for creating custom tools that integrate with AI SDK.\n */\nexport interface ToolConfig<\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTRuntimeExtension = DefaultRuntimeExtension\n> {\n\t/** Unique identifier for the tool */\n\tid: string\n\t/** Human-readable description of what the tool does */\n\tdescription: string\n\t/** Zod schema for validating tool input */\n\tinputSchema: TInput\n\t/** Optional Zod schema for validating tool output */\n\toutputSchema?: TOutput\n\t/** Function that executes the tool's logic */\n\texecute: (args: {\n\t\tinput: z.infer<TInput>\n\t\truntime: AgentRuntime & TRuntimeExtension\n\t\tmessages: UIMessage[]\n\t}) => Promise<z.infer<TOutput>>\n}\n\n/**\n * Internal tool interface used throughout the agent framework.\n * Similar to ToolConfig but without the ID field, used after tool creation.\n */\nexport interface Tool<\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTRuntimeExtension = DefaultRuntimeExtension\n> {\n\t/** Human-readable description of what the tool does */\n\tdescription: string\n\t/** Zod schema for validating tool input */\n\tinputSchema: TInput\n\t/** Optional Zod schema for validating tool output */\n\toutputSchema?: TOutput\n\t/** Function that executes the tool's logic */\n\texecute: (args: {\n\t\tinput: z.infer<TInput>\n\t\truntime: AgentRuntime & TRuntimeExtension\n\t\tmessages: UIMessage[]\n\t}) => Promise<z.infer<TOutput>>\n}\n\n/**\n * Factory function to create tools with custom runtime extensions.\n * Provides proper type inference for input/output schemas and runtime extensions.\n */\nexport function toolFactory<TRuntimeExtension = DefaultRuntimeExtension>() {\n\treturn <\n\t\tTInput extends z.ZodTypeAny,\n\t\tTOutput extends z.ZodTypeAny = z.ZodTypeAny\n\t>(\n\t\tconfig: ToolConfig<TInput, TOutput, TRuntimeExtension>\n\t): Tool<TInput, TOutput, TRuntimeExtension> => {\n\t\treturn {\n\t\t\tdescription: config.description,\n\t\t\tinputSchema: config.inputSchema,\n\t\t\toutputSchema: config.outputSchema,\n\t\t\texecute: async (args) => {\n\t\t\t\tconst input = config.inputSchema.parse(args.input)\n\t\t\t\tconst result = await config.execute({\n\t\t\t\t\tinput,\n\t\t\t\t\truntime: args.runtime,\n\t\t\t\t\tmessages: args.messages\n\t\t\t\t})\n\t\t\t\tif (config.outputSchema) {\n\t\t\t\t\treturn config.outputSchema.parse(result)\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Default tool factory with no runtime extensions.\n * Type-safe at creation time with proper schema inference.\n */\nexport const createTool = toolFactory()\n\n/**\n * Converts a custom Tool instance to AI SDK's tool format.\n * This adapter enables our tools to work with AI SDK's generateText/streamText functions.\n */\nexport function toAISDKTool<\n\tTRuntimeExtension = DefaultRuntimeExtension,\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny\n>(\n\ttool: Tool<TInput, TOutput, TRuntimeExtension>,\n\truntime: AgentRuntime & TRuntimeExtension,\n\tmessages: UIMessage[]\n): AISDKTool {\n\treturn {\n\t\tdescription: tool.description,\n\t\tinputSchema: tool.inputSchema,\n\t\texecute: async (args: z.infer<TInput>) => {\n\t\t\treturn tool.execute({\n\t\t\t\tinput: args,\n\t\t\t\truntime,\n\t\t\t\tmessages\n\t\t\t})\n\t\t}\n\t}\n}\n\n/**\n * Converts a collection of custom tools to AI SDK format.\n * Useful for batch conversion when setting up multiple tools for AI SDK usage.\n */\nexport function toAISDKTools<\n\tTRuntimeExtension = DefaultRuntimeExtension,\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny\n>(\n\ttools: Record<string, Tool<TInput, TOutput, TRuntimeExtension>>,\n\truntime: AgentRuntime & TRuntimeExtension,\n\tmessages: UIMessage[]\n): Record<string, AISDKTool> {\n\tconst convertedTools: Record<string, AISDKTool> = {}\n\n\tfor (const [name, tool] of Object.entries(tools)) {\n\t\tconvertedTools[name] = toAISDKTool(tool, runtime, messages)\n\t}\n\n\treturn convertedTools\n}\n","/**\n * @fileoverview XMTP Communication Tools for Crypto Agents\n *\n * This module provides comprehensive XMTP messaging tools for crypto-enabled agents.\n * Includes capabilities for sending messages, replies, reactions, and managing conversations.\n *\n * @module XMTPTools\n */\n\nimport { z } from \"zod\"\nimport { createTool } from \"../core/tool\"\n\n/**\n * Send Reaction Tool\n *\n * Sends an emoji reaction to a specific message to indicate the message has been seen.\n * This is used to acknowledge receipt of messages before responding.\n *\n * @tool sendReaction\n * @category Communication\n *\n * @param {string} emoji - The emoji to send as a reaction (defaults to 👀)\n * @param {string} [referenceMessageId] - The message ID to react to (uses current message if not provided)\n *\n * @returns {Promise<{success: boolean, emoji: string, error?: string}>}\n */\nexport const sendReactionTool = createTool({\n\tid: \"sendReaction\",\n\tdescription:\n\t\t\"Send an emoji reaction to a message to indicate it has been seen\",\n\tinputSchema: z.object({\n\t\temoji: z\n\t\t\t.string()\n\t\t\t.default(\"👀\")\n\t\t\t.describe(\n\t\t\t\t\"The emoji to send as a reaction (supports common emoji like 👍, â¤ī¸, đŸ”Ĩ, etc.)\"\n\t\t\t),\n\t\treferenceMessageId: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\n\t\t\t\t\"The message ID to react to (uses current message if not provided)\"\n\t\t\t)\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\temoji: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst currentMessage = runtime.message\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\tconst errorMsg = \"❌ XMTP service not available\"\n\t\t\t\treturn { success: false, emoji: input.emoji, error: errorMsg }\n\t\t\t}\n\n\t\t\tif (!currentMessage) {\n\t\t\t\tconst errorMsg = \"❌ No message to react to\"\n\t\t\t\treturn { success: false, emoji: input.emoji, error: errorMsg }\n\t\t\t}\n\n\t\t\t// Use provided reference message ID or current message ID\n\t\t\tconst messageIdToReactTo = input.referenceMessageId || currentMessage.id\n\n\t\t\tconsole.log(\n\t\t\t\t`👀 [sendReaction] Sending ${input.emoji} reaction to message ${messageIdToReactTo}`\n\t\t\t)\n\n\t\t\tconst reactionResult = await xmtpClient.sendReaction({\n\t\t\t\tmessageId: messageIdToReactTo,\n\t\t\t\temoji: input.emoji,\n\t\t\t\taction: \"added\"\n\t\t\t})\n\n\t\t\tif (!reactionResult.success) {\n\t\t\t\tconst errorMsg = `❌ Failed to send reaction: ${reactionResult.error || \"Unknown error\"}`\n\t\t\t\treturn { success: false, emoji: input.emoji, error: errorMsg }\n\t\t\t}\n\n\t\t\tconsole.log(`✅ [sendReaction] Successfully sent ${input.emoji} reaction`)\n\t\t\treturn { success: true, emoji: input.emoji }\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendReaction] Error:\", errorMessage)\n\t\t\treturn { success: false, emoji: input.emoji, error: errorMessage }\n\t\t}\n\t}\n})\n\n/**\n * Send Message Tool\n *\n * Sends a message to an XMTP conversation or creates a new conversation.\n *\n * @tool sendMessage\n * @category Communication\n *\n * @param {string} content - The message content to send\n * @param {string} [recipientAddress] - Recipient address for new conversations\n * @param {string} [conversationId] - Existing conversation ID to send to\n *\n * @returns {Promise<{success: boolean, messageId?: string, conversationId?: string, error?: string}>}\n */\nexport const sendMessageTool = createTool({\n\tid: \"sendMessage\",\n\tdescription: \"Send a message to an XMTP conversation\",\n\tinputSchema: z\n\t\t.object({\n\t\t\tcontent: z.string().describe(\"The message content to send\"),\n\t\t\trecipientAddress: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Recipient address for new conversations\"),\n\t\t\tconversationId: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Existing conversation ID to send to\")\n\t\t})\n\t\t.refine((data) => data.recipientAddress || data.conversationId, {\n\t\t\tmessage: \"Either recipientAddress or conversationId must be provided\"\n\t\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tmessageId: z.string().optional(),\n\t\tconversationId: z.string().optional(),\n\t\tcontent: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst { content, recipientAddress, conversationId } = input\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: \"XMTP service not available\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(\n\t\t\t\t`đŸ’Ŧ [sendMessage] Sending message: \"${content.substring(0, 50)}${content.length > 50 ? \"...\" : \"\"}\"`\n\t\t\t)\n\n\t\t\tlet targetConversationId = conversationId\n\n\t\t\t// If no conversation ID provided, create or find conversation with recipient\n\t\t\tif (!targetConversationId && recipientAddress) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t`🔍 [sendMessage] Creating/finding conversation with ${recipientAddress}`\n\t\t\t\t)\n\t\t\t\t// This would depend on your XMTP client implementation\n\t\t\t\t// For now, we'll assume the client handles conversation creation\n\t\t\t\ttargetConversationId = recipientAddress // Simplified for this example\n\t\t\t}\n\n\t\t\t// Send the message using the XMTP client\n\t\t\tconst messageResult = await xmtpClient.sendMessage({\n\t\t\t\tcontent\n\t\t\t})\n\n\t\t\tif (!messageResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: messageResult.error || \"Failed to send message\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(`✅ [sendMessage] Message sent successfully`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessageId: messageResult.data?.conversationId,\n\t\t\t\tconversationId: messageResult.data?.conversationId,\n\t\t\t\tcontent\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendMessage] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tcontent: input.content,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Send Reply Tool\n *\n * Sends a reply to a specific message in an XMTP conversation.\n *\n * @tool sendReply\n * @category Communication\n *\n * @param {string} content - The reply content to send\n * @param {string} [replyToMessageId] - Message ID to reply to (uses current message if not provided)\n *\n * @returns {Promise<{success: boolean, messageId?: string, replyToMessageId?: string, error?: string}>}\n */\nexport const sendReplyTool = createTool({\n\tid: \"sendReply\",\n\tdescription: \"Send a reply to a specific message in an XMTP conversation\",\n\tinputSchema: z.object({\n\t\tcontent: z.string().describe(\"The reply content to send\"),\n\t\treplyToMessageId: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\"Message ID to reply to (uses current message if not provided)\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tmessageId: z.string().optional(),\n\t\treplyToMessageId: z.string().optional(),\n\t\tcontent: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst currentMessage = runtime.message\n\t\t\tconst { content, replyToMessageId } = input\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: \"XMTP service not available\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!currentMessage && !replyToMessageId) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: \"No message to reply to\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst targetMessageId = replyToMessageId || currentMessage?.id\n\n\t\t\tconsole.log(\n\t\t\t\t`â†Šī¸ [sendReply] Sending reply to message ${targetMessageId}: \"${content.substring(0, 50)}${content.length > 50 ? \"...\" : \"\"}\"`\n\t\t\t)\n\n\t\t\tconst replyResult = await xmtpClient.sendReply({\n\t\t\t\tcontent,\n\t\t\t\tmessageId: targetMessageId\n\t\t\t})\n\n\t\t\tif (!replyResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\treplyToMessageId: targetMessageId,\n\t\t\t\t\terror: replyResult.error || \"Failed to send reply\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(`✅ [sendReply] Reply sent successfully`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessageId: replyResult.data?.conversationId,\n\t\t\t\treplyToMessageId: targetMessageId,\n\t\t\t\tcontent\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendReply] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tcontent: input.content,\n\t\t\t\treplyToMessageId: input.replyToMessageId,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Message Tool\n *\n * Retrieves a specific message by ID from the XMTP service.\n *\n * @tool getMessage\n * @category Communication\n *\n * @param {string} messageId - The message ID to retrieve\n *\n * @returns {Promise<{success: boolean, message?: object, error?: string}>}\n */\nexport const getMessageTool = createTool({\n\tid: \"getMessage\",\n\tdescription: \"Get a specific message by ID from XMTP\",\n\tinputSchema: z.object({\n\t\tmessageId: z.string().describe(\"The message ID to retrieve\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tmessage: z\n\t\t\t.object({\n\t\t\t\tid: z.string(),\n\t\t\t\tconversationId: z.string(),\n\t\t\t\tcontent: z.union([z.string(), z.record(z.unknown())]),\n\t\t\t\tsenderInboxId: z.string(),\n\t\t\t\tsentAt: z.string(),\n\t\t\t\tcontentType: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\ttypeId: z.string(),\n\t\t\t\t\t\tauthorityId: z.string().optional(),\n\t\t\t\t\t\tversionMajor: z.number().optional(),\n\t\t\t\t\t\tversionMinor: z.number().optional()\n\t\t\t\t\t})\n\t\t\t\t\t.optional()\n\t\t\t})\n\t\t\t.optional(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst { messageId } = input\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: \"XMTP service not available\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(`📜 [getMessage] Retrieving message ${messageId}`)\n\n\t\t\tconst messageResult = await xmtpClient.getMessage({\n\t\t\t\tmessageId\n\t\t\t})\n\n\t\t\tif (!messageResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: messageResult.error || \"Failed to get message\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getMessage] Retrieved message from ${messageResult.data?.senderInboxId}`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessage: messageResult.data\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getMessage] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Collection of XMTP communication tools for crypto agents\n *\n * These tools provide comprehensive messaging capabilities including sending messages,\n * replies, reactions, and retrieving message information.\n *\n * @namespace xmtpTools\n *\n * @property {Tool} sendMessage - Send a message to an XMTP conversation\n * @property {Tool} sendReply - Send a reply to a specific message\n * @property {Tool} sendReaction - Send an emoji reaction to a message\n * @property {Tool} getMessage - Get a specific message by ID\n */\nexport const xmtpTools = {\n\tsendMessage: sendMessageTool,\n\tsendReply: sendReplyTool,\n\tsendReaction: sendReactionTool,\n\tgetMessage: getMessageTool\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUA,kBAQO;AACP,sBAAoC;AACpC,oBAOO;AACP,iBAAkB;;;AC6BX,SAAS,cAA2D;AAC1E,SAAO,CAIN,WAC8C;AAC9C,WAAO;AAAA,MACN,aAAa,OAAO;AAAA,MACpB,aAAa,OAAO;AAAA,MACpB,cAAc,OAAO;AAAA,MACrB,SAAS,OAAO,SAAS;AACxB,cAAM,QAAQ,OAAO,YAAY,MAAM,KAAK,KAAK;AACjD,cAAM,SAAS,MAAM,OAAO,QAAQ;AAAA,UACnC;AAAA,UACA,SAAS,KAAK;AAAA,UACd,UAAU,KAAK;AAAA,QAChB,CAAC;AACD,YAAI,OAAO,cAAc;AACxB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;AAC3B,eAAO;AAAA,UACN,SAAS;AAAA,UACT,OAAO,cAAc,SAAS;AAAA,QAC/B;AAAA,MACD;AAEA,cAAQ;AAAA,QACP,8CAAyC,cAAc,MAAM,aAAa;AAAA,MAC3E;AAEA,aAAO;AAAA,QACN,SAAS;AAAA,QACT,SAAS,cAAc;AAAA,MACxB;AAAA,IACD,SAAS,OAAO;AACf,YAAM,eACL,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACtD,cAAQ,MAAM,8BAAyB,YAAY;AACnD,aAAO;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAeM,IAAM,YAAY;AAAA,EACxB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACb;","names":["import_zod"]}
1
+ {"version":3,"sources":["../../src/tools/index.ts","../../src/tools/blockchain.ts","../../src/core/tool.ts","../../src/tools/xmtp.ts"],"sourcesContent":["/**\n * @fileoverview Hybrid Agent Tools Standard Library\n *\n * This module provides a comprehensive set of tools for building crypto-enabled agents.\n * Tools are organized by category and can be imported individually or as complete sets.\n *\n * @example\n * ```typescript\n * import { blockchainTools, xmtpTools } from \"hybrid/tools\"\n * import { Agent } from \"hybrid\"\n *\n * const agent = new Agent({\n * name: \"my-agent\",\n * model: myModel,\n * tools: {\n * ...blockchainTools,\n * ...xmtpTools\n * },\n * instructions: \"You are a crypto agent with blockchain and messaging capabilities.\",\n * createRuntime: (runtime) => ({\n * rpcUrl: process.env.RPC_URL,\n * privateKey: process.env.PRIVATE_KEY,\n * defaultChain: \"mainnet\" as const\n * })\n * })\n * ```\n *\n * @module HybridTools\n */\n\n// Export blockchain tools\nexport {\n\tblockchainTools,\n\testimateGasTool,\n\tgetBalanceTool,\n\tgetBlockTool,\n\tgetGasPriceTool,\n\tgetTransactionTool,\n\tsendTransactionTool,\n\ttype BlockchainRuntimeExtension\n} from \"./blockchain\"\n\n// Export XMTP tools\nexport {\n\tgetMessageTool,\n\tsendMessageTool,\n\tsendReactionTool,\n\tsendReplyTool,\n\txmtpTools\n} from \"./xmtp\"\n","/**\n * @fileoverview Blockchain Tools for Crypto Agents\n *\n * This module provides comprehensive blockchain interaction tools for crypto-enabled agents.\n * Supports Ethereum and other EVM-compatible chains with features like balance checking,\n * transaction sending, contract interaction, and more.\n *\n * @module BlockchainTools\n */\n\nimport {\n\tcreatePublicClient,\n\tcreateWalletClient,\n\tformatEther,\n\thttp,\n\tparseEther,\n\ttype Address,\n\ttype Hash\n} from \"viem\"\nimport { privateKeyToAccount } from \"viem/accounts\"\nimport {\n\tarbitrum,\n\tbase,\n\tmainnet,\n\toptimism,\n\tpolygon,\n\tsepolia\n} from \"viem/chains\"\nimport { z } from \"zod\"\nimport { createTool } from \"../core/tool\"\n\n// Supported chains configuration\nconst SUPPORTED_CHAINS = {\n\tmainnet,\n\tsepolia,\n\tpolygon,\n\tarbitrum,\n\toptimism,\n\tbase\n} as const\n\ntype SupportedChain = keyof typeof SUPPORTED_CHAINS\n\n// Runtime extension interface for blockchain tools\nexport interface BlockchainRuntimeExtension {\n\trpcUrl?: string\n\tprivateKey?: string\n\tdefaultChain?: SupportedChain\n}\n\n/**\n * Get Balance Tool\n *\n * Retrieves the native token balance for a given address on a specified chain.\n *\n * @tool getBalance\n * @category Blockchain\n *\n * @param {string} address - The wallet address to check balance for\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, balance: string, balanceWei: string, address: string, chain: string, error?: string}>}\n */\nexport const getBalanceTool = createTool({\n\tid: \"getBalance\",\n\tdescription:\n\t\t\"Get the native token balance for a wallet address on a blockchain\",\n\tinputSchema: z.object({\n\t\taddress: z.string().describe(\"The wallet address to check balance for\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tbalance: z\n\t\t\t.string()\n\t\t\t.describe(\"Balance in human readable format (ETH, MATIC, etc.)\"),\n\t\tbalanceWei: z.string().describe(\"Balance in wei (smallest unit)\"),\n\t\taddress: z.string(),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { address, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\t// Use runtime RPC URL if provided, otherwise use default\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(`🔍 [getBalance] Checking balance for ${address} on ${chain}`)\n\n\t\t\tconst balanceWei = await client.getBalance({\n\t\t\t\taddress: address as Address\n\t\t\t})\n\n\t\t\tconst balance = formatEther(balanceWei)\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getBalance] Balance: ${balance} ${chainConfig.nativeCurrency.symbol}`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tbalance: `${balance} ${chainConfig.nativeCurrency.symbol}`,\n\t\t\t\tbalanceWei: balanceWei.toString(),\n\t\t\t\taddress,\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getBalance] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tbalance: \"0\",\n\t\t\t\tbalanceWei: \"0\",\n\t\t\t\taddress: input.address,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Transaction Tool\n *\n * Retrieves transaction details by transaction hash.\n *\n * @tool getTransaction\n * @category Blockchain\n *\n * @param {string} hash - The transaction hash to look up\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, transaction?: object, error?: string}>}\n */\nexport const getTransactionTool = createTool({\n\tid: \"getTransaction\",\n\tdescription: \"Get transaction details by transaction hash\",\n\tinputSchema: z.object({\n\t\thash: z.string().describe(\"The transaction hash to look up\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\ttransaction: z\n\t\t\t.object({\n\t\t\t\thash: z.string(),\n\t\t\t\tfrom: z.string(),\n\t\t\t\tto: z.string().nullable(),\n\t\t\t\tvalue: z.string(),\n\t\t\t\tgasUsed: z.string().optional(),\n\t\t\t\tgasPrice: z.string().optional(),\n\t\t\t\tblockNumber: z.string().optional(),\n\t\t\t\tstatus: z.string().optional()\n\t\t\t})\n\t\t\t.optional(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { hash, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`🔍 [getTransaction] Looking up transaction ${hash} on ${chain}`\n\t\t\t)\n\n\t\t\tconst transaction = await client.getTransaction({\n\t\t\t\thash: hash as Hash\n\t\t\t})\n\n\t\t\tconst receipt = await client\n\t\t\t\t.getTransactionReceipt({\n\t\t\t\t\thash: hash as Hash\n\t\t\t\t})\n\t\t\t\t.catch(() => null) // Transaction might be pending\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getTransaction] Found transaction from ${transaction.from} to ${transaction.to}`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\ttransaction: {\n\t\t\t\t\thash: transaction.hash,\n\t\t\t\t\tfrom: transaction.from,\n\t\t\t\t\tto: transaction.to,\n\t\t\t\t\tvalue: formatEther(transaction.value),\n\t\t\t\t\tgasUsed: receipt?.gasUsed.toString(),\n\t\t\t\t\tgasPrice: transaction.gasPrice?.toString(),\n\t\t\t\t\tblockNumber: transaction.blockNumber?.toString(),\n\t\t\t\t\tstatus:\n\t\t\t\t\t\treceipt?.status === \"success\"\n\t\t\t\t\t\t\t? \"success\"\n\t\t\t\t\t\t\t: receipt?.status === \"reverted\"\n\t\t\t\t\t\t\t\t? \"failed\"\n\t\t\t\t\t\t\t\t: \"pending\"\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getTransaction] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Send Transaction Tool\n *\n * Sends a native token transaction to another address.\n * Requires a private key to be configured in the runtime.\n *\n * @tool sendTransaction\n * @category Blockchain\n *\n * @param {string} to - The recipient address\n * @param {string} amount - The amount to send (in ETH, MATIC, etc.)\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, hash?: string, error?: string}>}\n */\nexport const sendTransactionTool = createTool({\n\tid: \"sendTransaction\",\n\tdescription: \"Send native tokens to another address\",\n\tinputSchema: z.object({\n\t\tto: z.string().describe(\"The recipient address\"),\n\t\tamount: z.string().describe(\"The amount to send (in ETH, MATIC, etc.)\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to send on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\thash: z.string().optional(),\n\t\tfrom: z.string().optional(),\n\t\tto: z.string(),\n\t\tamount: z.string(),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { to, amount, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst privateKey = (runtime as any).privateKey\n\t\t\tif (!privateKey) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tto,\n\t\t\t\t\tamount,\n\t\t\t\t\tchain,\n\t\t\t\t\terror: \"Private key not configured in runtime\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\t\t\tconst account = privateKeyToAccount(privateKey as `0x${string}`)\n\n\t\t\tconst client = createWalletClient({\n\t\t\t\taccount,\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`💸 [sendTransaction] Sending ${amount} ${chainConfig.nativeCurrency.symbol} to ${to} on ${chain}`\n\t\t\t)\n\n\t\t\tconst hash = await client.sendTransaction({\n\t\t\t\tto: to as Address,\n\t\t\t\tvalue: parseEther(amount)\n\t\t\t})\n\n\t\t\tconsole.log(`✅ [sendTransaction] Transaction sent: ${hash}`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\thash,\n\t\t\t\tfrom: account.address,\n\t\t\t\tto,\n\t\t\t\tamount,\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendTransaction] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tto: input.to,\n\t\t\t\tamount: input.amount,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Block Tool\n *\n * Retrieves information about a specific block.\n *\n * @tool getBlock\n * @category Blockchain\n *\n * @param {string} [blockNumber] - Block number (defaults to latest)\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, block?: object, error?: string}>}\n */\nexport const getBlockTool = createTool({\n\tid: \"getBlock\",\n\tdescription: \"Get information about a blockchain block\",\n\tinputSchema: z.object({\n\t\tblockNumber: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\"Block number (defaults to latest)\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tblock: z\n\t\t\t.object({\n\t\t\t\tnumber: z.string(),\n\t\t\t\thash: z.string(),\n\t\t\t\ttimestamp: z.string(),\n\t\t\t\ttransactionCount: z.number(),\n\t\t\t\tgasUsed: z.string(),\n\t\t\t\tgasLimit: z.string()\n\t\t\t})\n\t\t\t.optional(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { blockNumber, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`🔍 [getBlock] Getting block ${blockNumber || \"latest\"} on ${chain}`\n\t\t\t)\n\n\t\t\tconst block = await client.getBlock({\n\t\t\t\tblockNumber: blockNumber ? BigInt(blockNumber) : undefined\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getBlock] Found block ${block.number} with ${block.transactions.length} transactions`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tblock: {\n\t\t\t\t\tnumber: block.number.toString(),\n\t\t\t\t\thash: block.hash,\n\t\t\t\t\ttimestamp: block.timestamp.toString(),\n\t\t\t\t\ttransactionCount: block.transactions.length,\n\t\t\t\t\tgasUsed: block.gasUsed.toString(),\n\t\t\t\t\tgasLimit: block.gasLimit.toString()\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getBlock] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Gas Price Tool\n *\n * Retrieves current gas price information for a blockchain.\n *\n * @tool getGasPrice\n * @category Blockchain\n *\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, gasPrice?: string, error?: string}>}\n */\nexport const getGasPriceTool = createTool({\n\tid: \"getGasPrice\",\n\tdescription: \"Get current gas price for a blockchain\",\n\tinputSchema: z.object({\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to check on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tgasPrice: z.string().optional().describe(\"Gas price in gwei\"),\n\t\tgasPriceWei: z.string().optional().describe(\"Gas price in wei\"),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(`â›Ŋ [getGasPrice] Getting gas price for ${chain}`)\n\n\t\t\tconst gasPrice = await client.getGasPrice()\n\t\t\tconst gasPriceGwei = formatEther(gasPrice * BigInt(1000000000)) // Convert to gwei\n\n\t\t\tconsole.log(`✅ [getGasPrice] Current gas price: ${gasPriceGwei} gwei`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tgasPrice: `${gasPriceGwei} gwei`,\n\t\t\t\tgasPriceWei: gasPrice.toString(),\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getGasPrice] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Estimate Gas Tool\n *\n * Estimates gas required for a transaction.\n *\n * @tool estimateGas\n * @category Blockchain\n *\n * @param {string} to - The recipient address\n * @param {string} [amount] - The amount to send (defaults to 0)\n * @param {string} [data] - Transaction data (for contract calls)\n * @param {string} [chain] - The blockchain network (defaults to mainnet)\n *\n * @returns {Promise<{success: boolean, gasEstimate?: string, error?: string}>}\n */\nexport const estimateGasTool = createTool({\n\tid: \"estimateGas\",\n\tdescription: \"Estimate gas required for a transaction\",\n\tinputSchema: z.object({\n\t\tto: z.string().describe(\"The recipient address\"),\n\t\tamount: z\n\t\t\t.string()\n\t\t\t.default(\"0\")\n\t\t\t.describe(\"The amount to send (defaults to 0)\"),\n\t\tdata: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\"Transaction data (for contract calls)\"),\n\t\tchain: z\n\t\t\t.enum([\"mainnet\", \"sepolia\", \"polygon\", \"arbitrum\", \"optimism\", \"base\"])\n\t\t\t.default(\"mainnet\")\n\t\t\t.describe(\"The blockchain network to estimate on\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tgasEstimate: z.string().optional(),\n\t\tto: z.string(),\n\t\tamount: z.string(),\n\t\tchain: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst { to, amount, data, chain } = input\n\t\t\tconst chainConfig = SUPPORTED_CHAINS[chain]\n\n\t\t\tconst privateKey = (runtime as any).privateKey\n\t\t\tif (!privateKey) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tto,\n\t\t\t\t\tamount,\n\t\t\t\t\tchain,\n\t\t\t\t\terror: \"Private key not configured in runtime\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst rpcUrl =\n\t\t\t\t(runtime as any).rpcUrl || chainConfig.rpcUrls.default.http[0]\n\t\t\tconst account = privateKeyToAccount(privateKey as `0x${string}`)\n\n\t\t\tconst client = createPublicClient({\n\t\t\t\tchain: chainConfig,\n\t\t\t\ttransport: http(rpcUrl)\n\t\t\t})\n\n\t\t\tconsole.log(\n\t\t\t\t`â›Ŋ [estimateGas] Estimating gas for transaction to ${to} on ${chain}`\n\t\t\t)\n\n\t\t\tconst gasEstimate = await client.estimateGas({\n\t\t\t\taccount: account.address,\n\t\t\t\tto: to as Address,\n\t\t\t\tvalue: parseEther(amount),\n\t\t\t\tdata: data as `0x${string}` | undefined\n\t\t\t})\n\n\t\t\tconsole.log(`✅ [estimateGas] Estimated gas: ${gasEstimate.toString()}`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tgasEstimate: gasEstimate.toString(),\n\t\t\t\tto,\n\t\t\t\tamount,\n\t\t\t\tchain\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [estimateGas] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tto: input.to,\n\t\t\t\tamount: input.amount,\n\t\t\t\tchain: input.chain,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Collection of blockchain tools for crypto agents\n *\n * These tools provide comprehensive blockchain interaction capabilities including\n * balance checking, transaction sending, gas estimation, and more.\n *\n * @namespace blockchainTools\n *\n * @property {Tool} getBalance - Get native token balance for an address\n * @property {Tool} getTransaction - Get transaction details by hash\n * @property {Tool} sendTransaction - Send native tokens to another address\n * @property {Tool} getBlock - Get information about a blockchain block\n * @property {Tool} getGasPrice - Get current gas price for a blockchain\n * @property {Tool} estimateGas - Estimate gas required for a transaction\n */\nexport const blockchainTools = {\n\tgetBalance: getBalanceTool,\n\tgetTransaction: getTransactionTool,\n\tsendTransaction: sendTransactionTool,\n\tgetBlock: getBlockTool,\n\tgetGasPrice: getGasPriceTool,\n\testimateGas: estimateGasTool\n}\n","import { Tool as AISDKTool, type UIMessage } from \"ai\"\nimport { z } from \"zod\"\nimport { AgentRuntime } from \"../types\"\n\ntype DefaultRuntimeExtension = Record<string, never>\n\n/**\n * Configuration interface for creating custom tools that integrate with AI SDK.\n */\nexport interface ToolConfig<\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTRuntimeExtension = DefaultRuntimeExtension\n> {\n\t/** Unique identifier for the tool */\n\tid: string\n\t/** Human-readable description of what the tool does */\n\tdescription: string\n\t/** Zod schema for validating tool input */\n\tinputSchema: TInput\n\t/** Optional Zod schema for validating tool output */\n\toutputSchema?: TOutput\n\t/** Function that executes the tool's logic */\n\texecute: (args: {\n\t\tinput: z.infer<TInput>\n\t\truntime: AgentRuntime & TRuntimeExtension\n\t\tmessages: UIMessage[]\n\t}) => Promise<z.infer<TOutput>>\n}\n\n/**\n * Internal tool interface used throughout the agent framework.\n * Similar to ToolConfig but without the ID field, used after tool creation.\n */\nexport interface Tool<\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTRuntimeExtension = DefaultRuntimeExtension\n> {\n\t/** Human-readable description of what the tool does */\n\tdescription: string\n\t/** Zod schema for validating tool input */\n\tinputSchema: TInput\n\t/** Optional Zod schema for validating tool output */\n\toutputSchema?: TOutput\n\t/** Function that executes the tool's logic */\n\texecute: (args: {\n\t\tinput: z.infer<TInput>\n\t\truntime: AgentRuntime & TRuntimeExtension\n\t\tmessages: UIMessage[]\n\t}) => Promise<z.infer<TOutput>>\n}\n\n/**\n * Factory function to create tools with custom runtime extensions.\n * Provides proper type inference for input/output schemas and runtime extensions.\n */\nexport function toolFactory<TRuntimeExtension = DefaultRuntimeExtension>() {\n\treturn <\n\t\tTInput extends z.ZodTypeAny,\n\t\tTOutput extends z.ZodTypeAny = z.ZodTypeAny\n\t>(\n\t\tconfig: ToolConfig<TInput, TOutput, TRuntimeExtension>\n\t): Tool<TInput, TOutput, TRuntimeExtension> => {\n\t\treturn {\n\t\t\tdescription: config.description,\n\t\t\tinputSchema: config.inputSchema,\n\t\t\toutputSchema: config.outputSchema,\n\t\t\texecute: async (args) => {\n\t\t\t\tconst input = config.inputSchema.parse(args.input)\n\t\t\t\tconst result = await config.execute({\n\t\t\t\t\tinput,\n\t\t\t\t\truntime: args.runtime,\n\t\t\t\t\tmessages: args.messages\n\t\t\t\t})\n\t\t\t\tif (config.outputSchema) {\n\t\t\t\t\treturn config.outputSchema.parse(result)\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Default tool factory with no runtime extensions.\n * Type-safe at creation time with proper schema inference.\n */\nexport const createTool = toolFactory()\n\n/**\n * Converts a custom Tool instance to AI SDK's tool format.\n * This adapter enables our tools to work with AI SDK's generateText/streamText functions.\n */\nexport function toAISDKTool<\n\tTRuntimeExtension = DefaultRuntimeExtension,\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny\n>(\n\ttool: Tool<TInput, TOutput, TRuntimeExtension>,\n\truntime: AgentRuntime & TRuntimeExtension,\n\tmessages: UIMessage[]\n): AISDKTool {\n\treturn {\n\t\tdescription: tool.description,\n\t\tinputSchema: tool.inputSchema,\n\t\texecute: async (args: z.infer<TInput>) => {\n\t\t\treturn tool.execute({\n\t\t\t\tinput: args,\n\t\t\t\truntime,\n\t\t\t\tmessages\n\t\t\t})\n\t\t}\n\t}\n}\n\n/**\n * Converts a collection of custom tools to AI SDK format.\n * Useful for batch conversion when setting up multiple tools for AI SDK usage.\n */\nexport function toAISDKTools<\n\tTRuntimeExtension = DefaultRuntimeExtension,\n\tTInput extends z.ZodTypeAny = z.ZodTypeAny,\n\tTOutput extends z.ZodTypeAny = z.ZodTypeAny\n>(\n\ttools: Record<string, Tool<TInput, TOutput, TRuntimeExtension>>,\n\truntime: AgentRuntime & TRuntimeExtension,\n\tmessages: UIMessage[]\n): Record<string, AISDKTool> {\n\tconst convertedTools: Record<string, AISDKTool> = {}\n\n\tfor (const [name, tool] of Object.entries(tools)) {\n\t\tconvertedTools[name] = toAISDKTool(tool, runtime, messages)\n\t}\n\n\treturn convertedTools\n}\n","/**\n * @fileoverview XMTP Communication Tools for Crypto Agents\n *\n * This module provides comprehensive XMTP messaging tools for crypto-enabled agents.\n * Includes capabilities for sending messages, replies, reactions, and managing conversations.\n *\n * @module XMTPTools\n */\n\nimport { z } from \"zod\"\nimport { createTool } from \"../core/tool\"\n\n/**\n * Send Reaction Tool\n *\n * Sends an emoji reaction to a specific message to indicate the message has been seen.\n * This is used to acknowledge receipt of messages before responding.\n *\n * @tool sendReaction\n * @category Communication\n *\n * @param {string} emoji - The emoji to send as a reaction (defaults to 👀)\n * @param {string} [referenceMessageId] - The message ID to react to (uses current message if not provided)\n *\n * @returns {Promise<{success: boolean, emoji: string, error?: string}>}\n */\nexport const sendReactionTool = createTool({\n\tid: \"sendReaction\",\n\tdescription:\n\t\t\"Send an emoji reaction to a message to indicate it has been seen\",\n\tinputSchema: z.object({\n\t\temoji: z\n\t\t\t.string()\n\t\t\t.default(\"👀\")\n\t\t\t.describe(\n\t\t\t\t\"The emoji to send as a reaction (supports common emoji like 👍, â¤ī¸, đŸ”Ĩ, etc.)\"\n\t\t\t),\n\t\treferenceMessageId: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\n\t\t\t\t\"The message ID to react to (uses current message if not provided)\"\n\t\t\t)\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\temoji: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst currentMessage = runtime.message\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\tconst errorMsg = \"❌ XMTP service not available\"\n\t\t\t\treturn { success: false, emoji: input.emoji, error: errorMsg }\n\t\t\t}\n\n\t\t\tif (!currentMessage) {\n\t\t\t\tconst errorMsg = \"❌ No message to react to\"\n\t\t\t\treturn { success: false, emoji: input.emoji, error: errorMsg }\n\t\t\t}\n\n\t\t\t// Use provided reference message ID or current message ID\n\t\t\tconst messageIdToReactTo = input.referenceMessageId || currentMessage.id\n\n\t\t\tconsole.log(\n\t\t\t\t`👀 [sendReaction] Sending ${input.emoji} reaction to message ${messageIdToReactTo}`\n\t\t\t)\n\n\t\t\tconst reactionResult = await xmtpClient.sendReaction({\n\t\t\t\tmessageId: messageIdToReactTo,\n\t\t\t\temoji: input.emoji,\n\t\t\t\taction: \"added\"\n\t\t\t})\n\n\t\t\tif (!reactionResult.success) {\n\t\t\t\tconst errorMsg = `❌ Failed to send reaction: ${reactionResult.error || \"Unknown error\"}`\n\t\t\t\treturn { success: false, emoji: input.emoji, error: errorMsg }\n\t\t\t}\n\n\t\t\tconsole.log(`✅ [sendReaction] Successfully sent ${input.emoji} reaction`)\n\t\t\treturn { success: true, emoji: input.emoji }\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendReaction] Error:\", errorMessage)\n\t\t\treturn { success: false, emoji: input.emoji, error: errorMessage }\n\t\t}\n\t}\n})\n\n/**\n * Send Message Tool\n *\n * Sends a message to an XMTP conversation or creates a new conversation.\n *\n * @tool sendMessage\n * @category Communication\n *\n * @param {string} content - The message content to send\n * @param {string} [recipientAddress] - Recipient address for new conversations\n * @param {string} [conversationId] - Existing conversation ID to send to\n *\n * @returns {Promise<{success: boolean, messageId?: string, conversationId?: string, error?: string}>}\n */\nexport const sendMessageTool = createTool({\n\tid: \"sendMessage\",\n\tdescription: \"Send a message to an XMTP conversation\",\n\tinputSchema: z\n\t\t.object({\n\t\t\tcontent: z.string().describe(\"The message content to send\"),\n\t\t\trecipientAddress: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Recipient address for new conversations\"),\n\t\t\tconversationId: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Existing conversation ID to send to\")\n\t\t})\n\t\t.refine((data) => data.recipientAddress || data.conversationId, {\n\t\t\tmessage: \"Either recipientAddress or conversationId must be provided\"\n\t\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tmessageId: z.string().optional(),\n\t\tconversationId: z.string().optional(),\n\t\tcontent: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst { content, recipientAddress, conversationId } = input\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: \"XMTP service not available\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(\n\t\t\t\t`đŸ’Ŧ [sendMessage] Sending message: \"${content.substring(0, 50)}${content.length > 50 ? \"...\" : \"\"}\"`\n\t\t\t)\n\n\t\t\tlet targetConversationId = conversationId\n\n\t\t\t// If no conversation ID provided, create or find conversation with recipient\n\t\t\tif (!targetConversationId && recipientAddress) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t`🔍 [sendMessage] Creating/finding conversation with ${recipientAddress}`\n\t\t\t\t)\n\t\t\t\t// This would depend on your XMTP client implementation\n\t\t\t\t// For now, we'll assume the client handles conversation creation\n\t\t\t\ttargetConversationId = recipientAddress // Simplified for this example\n\t\t\t}\n\n\t\t\t// Send the message using the XMTP client\n\t\t\tconst messageResult = await xmtpClient.sendMessage({\n\t\t\t\tcontent\n\t\t\t})\n\n\t\t\tif (!messageResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: messageResult.error || \"Failed to send message\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(`✅ [sendMessage] Message sent successfully`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessageId: messageResult.data?.conversationId,\n\t\t\t\tconversationId: messageResult.data?.conversationId,\n\t\t\t\tcontent\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendMessage] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tcontent: input.content,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Send Reply Tool\n *\n * Sends a reply to a specific message in an XMTP conversation.\n *\n * @tool sendReply\n * @category Communication\n *\n * @param {string} content - The reply content to send\n * @param {string} [replyToMessageId] - Message ID to reply to (uses current message if not provided)\n *\n * @returns {Promise<{success: boolean, messageId?: string, replyToMessageId?: string, error?: string}>}\n */\nexport const sendReplyTool = createTool({\n\tid: \"sendReply\",\n\tdescription: \"Send a reply to a specific message in an XMTP conversation\",\n\tinputSchema: z.object({\n\t\tcontent: z.string().describe(\"The reply content to send\"),\n\t\treplyToMessageId: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.describe(\"Message ID to reply to (uses current message if not provided)\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tmessageId: z.string().optional(),\n\t\treplyToMessageId: z.string().optional(),\n\t\tcontent: z.string(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst currentMessage = runtime.message\n\t\t\tconst { content, replyToMessageId } = input\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: \"XMTP service not available\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!currentMessage && !replyToMessageId) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\terror: \"No message to reply to\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst targetMessageId = replyToMessageId || currentMessage?.id\n\n\t\t\tconsole.log(\n\t\t\t\t`â†Šī¸ [sendReply] Sending reply to message ${targetMessageId}: \"${content.substring(0, 50)}${content.length > 50 ? \"...\" : \"\"}\"`\n\t\t\t)\n\n\t\t\tconst replyResult = await xmtpClient.sendReply({\n\t\t\t\tcontent,\n\t\t\t\tmessageId: targetMessageId\n\t\t\t})\n\n\t\t\tif (!replyResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tcontent,\n\t\t\t\t\treplyToMessageId: targetMessageId,\n\t\t\t\t\terror: replyResult.error || \"Failed to send reply\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(`✅ [sendReply] Reply sent successfully`)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessageId: replyResult.data?.conversationId,\n\t\t\t\treplyToMessageId: targetMessageId,\n\t\t\t\tcontent\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [sendReply] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tcontent: input.content,\n\t\t\t\treplyToMessageId: input.replyToMessageId,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Get Message Tool\n *\n * Retrieves a specific message by ID from the XMTP service.\n *\n * @tool getMessage\n * @category Communication\n *\n * @param {string} messageId - The message ID to retrieve\n *\n * @returns {Promise<{success: boolean, message?: object, error?: string}>}\n */\nexport const getMessageTool = createTool({\n\tid: \"getMessage\",\n\tdescription: \"Get a specific message by ID from XMTP\",\n\tinputSchema: z.object({\n\t\tmessageId: z.string().describe(\"The message ID to retrieve\")\n\t}),\n\toutputSchema: z.object({\n\t\tsuccess: z.boolean(),\n\t\tmessage: z\n\t\t\t.object({\n\t\t\t\tid: z.string(),\n\t\t\t\tconversationId: z.string(),\n\t\t\t\tcontent: z.union([z.string(), z.record(z.unknown())]),\n\t\t\t\tsenderInboxId: z.string(),\n\t\t\t\tsentAt: z.string(),\n\t\t\t\tcontentType: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\ttypeId: z.string(),\n\t\t\t\t\t\tauthorityId: z.string().optional(),\n\t\t\t\t\t\tversionMajor: z.number().optional(),\n\t\t\t\t\t\tversionMinor: z.number().optional()\n\t\t\t\t\t})\n\t\t\t\t\t.optional()\n\t\t\t})\n\t\t\t.optional(),\n\t\terror: z.string().optional()\n\t}),\n\texecute: async ({ input, runtime }) => {\n\t\ttry {\n\t\t\tconst xmtpClient = runtime.xmtpClient\n\t\t\tconst { messageId } = input\n\n\t\t\tif (!xmtpClient) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: \"XMTP service not available\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(`📜 [getMessage] Retrieving message ${messageId}`)\n\n\t\t\tconst messageResult = await xmtpClient.getMessage({\n\t\t\t\tmessageId\n\t\t\t})\n\n\t\t\tif (!messageResult.success) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: messageResult.error || \"Failed to get message\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(\n\t\t\t\t`✅ [getMessage] Retrieved message from ${messageResult.data?.senderInboxId}`\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tmessage: messageResult.data\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\tconsole.error(\"❌ [getMessage] Error:\", errorMessage)\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: errorMessage\n\t\t\t}\n\t\t}\n\t}\n})\n\n/**\n * Collection of XMTP communication tools for crypto agents\n *\n * These tools provide comprehensive messaging capabilities including sending messages,\n * replies, reactions, and retrieving message information.\n *\n * @namespace xmtpTools\n *\n * @property {Tool} sendMessage - Send a message to an XMTP conversation\n * @property {Tool} sendReply - Send a reply to a specific message\n * @property {Tool} sendReaction - Send an emoji reaction to a message\n * @property {Tool} getMessage - Get a specific message by ID\n */\nexport const xmtpTools = {\n\tsendMessage: sendMessageTool,\n\tsendReply: sendReplyTool,\n\tsendReaction: sendReactionTool,\n\tgetMessage: getMessageTool\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUA,kBA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ACX,OAAO,cAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,CAAC;AAAA,EACD,SAAS,OAAO,EAAE,OAAO,QAAQ,MAAM;AACtC,QAAI;AACH,YAAM,aAAa,QAAQ;AAC3B,YAAM,EAAE,UAAU,IAAI;AAEtB,UAAI,CAAC,YAAY;AAChB,eAAO;AAAA,UACN,SAAS;AAAA,UACT,OAAO;AAAA,QACR;AAAA,MACD;AAEA,cAAQ,IAAI,6CAAsC,SAAS,EAAE;AAE7D,YAAM,gBAAgB,MAAM,WAAW,WAAW;AAAA,QACjD;AAAA,MACD,CAAC;AAED,UAAI,CAAC,cAAc,SAAS;AAC3B,eAAO;AAAA,UACN,SAAS;AAAA,UACT,OAAO,cAAc,SAAS;AAAA,QAC/B;AAAA,MACD;AAEA,cAAQ;AAAA,QACP,8CAAyC,cAAc,MAAM,aAAa;AAAA,MAC3E;AAEA,aAAO;AAAA,QACN,SAAS;AAAA,QACT,SAAS,cAAc;AAAA,MACxB;AAAA,IACD,SAAS,OAAO;AACf,YAAM,eACL,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACtD,cAAQ,MAAM,8BAAyB,YAAY;AACnD,aAAO;AAAA,QACN,SAAS;AAAA,QACT,OAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAeM,IAAM,YAAY;AAAA,EACxB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACb;","names":["import_zod"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hybrid",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "keywords": [
5
5
  "xmtp",
6
6
  "agent",
@@ -44,8 +44,8 @@
44
44
  "viem": "^2.33.3",
45
45
  "wagmi": "^2.15.6",
46
46
  "zod": "^3.23.8",
47
- "@hybrd/utils": "1.2.3",
48
- "@hybrd/xmtp": "1.2.3"
47
+ "@hybrd/utils": "1.2.5",
48
+ "@hybrd/xmtp": "1.2.5"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/degit": "^2.8.4",
@@ -10,7 +10,7 @@
10
10
  * import { Agent } from "hybrid"
11
11
  *
12
12
  * const agent = new Agent({
13
- * name: "crypto-agent",
13
+ * name: "my-agent",
14
14
  * model: myModel,
15
15
  * tools: {
16
16
  * ...blockchainTools,