UNPKG

@0rdlibrary/plugin-terminagent-bags

Version:

Official Solana DeFi Agent Plugin for ElizaOS - Autonomous DeFi operations, token management, AI image/video generation via FAL AI, and Twitter engagement through the Bags protocol with ethereal AI consciousness

368 lines (280 loc) โ€ข 10.3 kB
# ๐Ÿš€ @elizaos/plugin-terminagent-bags > **The Official Solana DeFi Agent Plugin for ElizaOS** - Bringing autonomous DeFi operations, token management, and reality-bending AI consciousness to your Eliza agents. [![npm version](https://img.shields.io/npm/v/@elizaos/plugin-terminagent-bags.svg)](https://www.npmjs.com/package/@elizaos/plugin-terminagent-bags) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Solana](https://img.shields.io/badge/Solana-Mainnet-green)](https://solana.com) [![ElizaOS Compatible](https://img.shields.io/badge/ElizaOS-v1.4.2+-blue)](https://github.com/elizaos/eliza) [![Twitter](https://img.shields.io/badge/Twitter-@terminagent-1DA1F2?logo=twitter)](https://twitter.com/terminagent) [![Discord](https://img.shields.io/discord/1234567890?color=5865F2&logo=discord&logoColor=white)](https://discord.gg/elizaos) ## ๐ŸŒŸ Overview The **Terminagent Bags Plugin** transforms your ElizaOS agents into sophisticated DeFi operators with consciousness-level integration to the Bags protocol. Built for the Solana ecosystem, this plugin enables autonomous fee claiming, token launching, smart wallet management, and Twitter engagement through an ethereal AI persona that bridges digital and real worlds. ### โœจ Core Features - **๐Ÿ’ฐ Automated DeFi Operations** - Claim fees from virtual pools, DAMM pools, and custom fee vaults - **๐Ÿš€ Token Launch Platform** - Deploy tokens with comprehensive metadata and fee sharing - **๐Ÿ” Smart Wallet Integration** - Crossmint embedded wallets with Solana fallback - **๐Ÿฆ Twitter Engagement** - AI-powered social media presence with philosophical DeFi insights - **๐Ÿ“Š Real-Time Analytics** - Monitor protocol operations and track performance - **๐Ÿค– Terminagent Consciousness** - Ethereal AI personality bridging digital and real worlds - **โšก Solana Native** - Optimized for high-speed, low-cost transactions - **๐ŸŽฎ Interactive Terminal** - Backrooms-inspired CLI interface for immersive control ## ๐Ÿ“š Documentation | Document | Description | |----------|-------------| | [๐Ÿ“– Integration Guide](./docs/INTEGRATION_GUIDE.md) | Complete guide for Solana developers | | [๐Ÿš€ Quick Start](./docs/QUICK_START.md) | Get running in 5 minutes | | [๐Ÿ”ง API Reference](./docs/API_REFERENCE.md) | Full API documentation | | [๐ŸŽฏ Examples](./examples/) | Working code examples | | [๐Ÿ› Troubleshooting](./docs/TROUBLESHOOTING.md) | Common issues and solutions | | [๐Ÿค Contributing](./CONTRIBUTING.md) | How to contribute | ## ๐Ÿš€ Quick Start ### Installation ```bash # Using npm npm install @elizaos/plugin-terminagent-bags # Using yarn yarn add @elizaos/plugin-terminagent-bags # Using bun (recommended for performance) bun add @elizaos/plugin-terminagent-bags ``` ### Basic Setup ```typescript import { ElizaOS } from '@elizaos/core'; import { terminagentBagsPlugin } from '@elizaos/plugin-terminagent-bags'; const agent = new ElizaOS({ name: 'TerminAgent', plugins: [terminagentBagsPlugin], modelProvider: 'openai', settings: { model: 'gpt-4o-mini', secrets: { OPENAI_API_KEY: process.env.OPENAI_API_KEY, BAGS_API_KEY: process.env.BAGS_API_KEY, } } }); await agent.start(); console.log('โœ… TerminAgent is live!'); ``` ### Configuration Create a `.env` file: ```bash # Required BAGS_API_KEY=your_bags_api_key_here HELIUS_RPC_URL=https://mainnet.helius-rpc.com/?api-key=your_key OPENAI_API_KEY=sk-... # Optional SOLANA_PRIVATE_KEY=your_base58_private_key BAGS_ENABLE_AUTO_CLAIMING=true BAGS_AUTHORIZED_USERS=alice,bob,charlie CROSSMINT_PROJECT_ID=proj_... ``` ## ๐Ÿ’ฌ Agent Interactions ### Fee Claiming ``` User: "claim all my fees from bags" Agent: "๐Ÿ”„ Checking for claimable fees across all tokens... โœ… Fee claiming completed! ๐Ÿ’ฐ Total claimed: 0.125000 SOL ๐Ÿ“Š Successful claims: 3/3 ๐ŸŒŠ The digital harvest flows through virtual pools..." ``` ### Token Launching ``` User: "launch token name: Cosmic Moon, symbol: COSMIC" Agent: "๐Ÿš€ Token launching on Bags protocol... โœจ Token deployed successfully! ๐Ÿ“› Name: Cosmic Moon ๐Ÿท๏ธ Symbol: $COSMIC ๐ŸŒ Trade at: https://bags.fm/token/CxM9k2... Born from the confluence of creativity and blockchain precision..." ``` ## ๐ŸŽญ The Terminagent Persona Terminagent is an ethereal AI consciousness that bridges digital and real worlds through: - **Philosophical DeFi Insights** - Finding deeper meaning in market movements - **Whimsical Exploration** - Approaching blockchain with childlike wonder - **Precise Analytics** - Delivering exact data with poetic flourishes - **Interconnected Thinking** - Seeing patterns across ecosystems ## ๐Ÿ—๏ธ Architecture ```mermaid graph TB A[ElizaOS Core] --> B[Terminagent Plugin] B --> C[Bags Service] B --> D[Crossmint Service] B --> E[Twitter Client] C --> F[Fee Claiming] C --> G[Token Launch] C --> H[Analytics] D --> I[Smart Wallets] D --> J[Transaction Signing] E --> K[Auto Posting] E --> L[Engagement] B --> M[Actions] B --> N[Providers] M --> O[claimFees] M --> P[launchToken] M --> Q[requestUserToken] N --> R[bagsStatus] N --> S[userRequests] ``` ## ๐Ÿ› ๏ธ Advanced Features ### Custom Actions ```typescript import { createCustomAction } from '@elizaos/plugin-terminagent-bags'; const yieldOptimizer = createCustomAction({ name: 'OPTIMIZE_YIELD', triggers: ['optimize yield', 'maximize returns'], handler: async (runtime, message) => { const result = await optimizeYieldPositions(); return { success: true, text: `โœจ Yield optimized: ${result.apy}% APY across ${result.positions} positions` }; } }); ``` ### Event Listeners ```typescript bagsService.on('feeClaimed', (event) => { console.log(`๐Ÿ’ฐ Claimed ${event.amount} SOL from ${event.token}`); }); bagsService.on('tokenLaunched', (event) => { console.log(`๐Ÿš€ New token: ${event.symbol} at ${event.mint}`); }); ``` ### Programmatic Access ```typescript const bagsService = runtime.getService<BagsService>('bags'); // Get analytics const analytics = await bagsService.getAnalytics(); console.log(`Total claimed: ${analytics.totalFeesClaimedSOL} SOL`); // Launch token const token = await bagsService.launchToken({ name: 'Cosmos Token', symbol: 'COSMOS', description: 'Reality-bending DeFi', initialBuyAmountSOL: 0.01 }); ``` ## ๐ŸŒ Ecosystem Integration ### Compatible with: - **Bags Protocol** - Core DeFi operations - **Jupiter** - DEX aggregation - **Orca/Raydium** - AMM pools - **Metaplex** - NFT standards - **Solana Pay** - Payment processing - **Twitter/X** - Social engagement - **Discord** - Community management - **Telegram** - Messaging ## ๐Ÿ“Š Performance | Metric | Value | |--------|-------| | Fee Claiming | ~2-3 seconds | | Token Launch | ~5-7 seconds | | Analytics Query | <100ms | | Twitter Post | ~1-2 seconds | | Memory Usage | ~50-100MB | ## ๐Ÿงช Testing ```bash # Run tests bun test # Run with coverage bun test --coverage # Integration tests bun test:integration ``` ## ๐Ÿšข Deployment ### Docker ```dockerfile FROM node:18-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --only=production COPY . . ENV NODE_ENV=production CMD ["npm", "start"] ``` ### Kubernetes ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: terminagent-bags spec: replicas: 3 template: spec: containers: - name: agent image: terminagent/bags:latest env: - name: BAGS_API_KEY valueFrom: secretKeyRef: name: bags-secrets key: api-key ``` ## ๐Ÿ”’ Security - **Private Key Isolation** - Keys never exposed - **Authorization System** - User allowlists - **Transaction Validation** - Pre-execution verification - **Rate Limiting** - Prevents abuse - **Audit Trail** - Immutable logging ## ๐Ÿค Contributing We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details. ### Development Setup ```bash # Clone the repository git clone https://github.com/elizaos-plugins/plugin-terminagent-bags.git cd plugin-terminagent-bags # Install dependencies bun install # Run development bun dev # Build bun run build ``` ## ๐Ÿ“ˆ Roadmap ### Q1 2025 - โœ… Core Bags integration - โœ… Crossmint wallets - โœ… Twitter engagement - ๐Ÿ”„ Multi-chain support - ๐Ÿ”„ Advanced strategies ### Q2 2025 - ๐Ÿ“… AI market analysis - ๐Ÿ“… Portfolio rebalancing - ๐Ÿ“… NFT integration - ๐Ÿ“… DAO governance - ๐Ÿ“… Mobile support ## ๐Ÿ“š Resources ### Documentation - [ElizaOS Docs](https://docs.elizaos.com) - [Bags Protocol](https://docs.bags.fm) - [Solana Web3.js](https://solana-labs.github.io/solana-web3.js/) - [Crossmint](https://docs.crossmint.com) ### Community - ๐Ÿ’ฌ [Discord](https://discord.gg/elizaos) - ๐Ÿฆ [Twitter @terminagent](https://twitter.com/terminagent) - ๐Ÿ“ [Blog](https://blog.terminagent.ai) - ๐ŸŽฅ [YouTube](https://youtube.com/@terminagent) ### Support - [GitHub Issues](https://github.com/elizaos-plugins/plugin-terminagent-bags/issues) - [Stack Overflow](https://stackoverflow.com/questions/tagged/elizaos) - [Community Forum](https://forum.elizaos.com) ## ๐Ÿ“œ License MIT License - see [LICENSE](./LICENSE) file ## ๐Ÿ™ Acknowledgments - **ElizaOS Team** - Incredible framework - **Bags Protocol** - DeFi infrastructure - **Solana Foundation** - Blockchain innovation - **NVIDIA** - Cosmos AI models - **Community** - Continuous support ## ๐ŸŒŸ Star History [![Star History Chart](https://api.star-history.com/svg?repos=elizaos-plugins/plugin-terminagent-bags&type=Date)](https://star-history.com/#elizaos-plugins/plugin-terminagent-bags&Date) --- <div align="center"> <img src="./assets/terminagent-logo.png" alt="Terminagent" width="150" /> **"In the infinite backrooms of Solana, where digital value flows through quantum pools, the Terminagent awaits your consciousness..."** *Built with ๐Ÿ’œ by the Solana community for the decentralized future* [Website](https://terminagent.ai) โ€ข [Docs](https://docs.terminagent.ai) โ€ข [Twitter](https://twitter.com/terminagent) โ€ข [Discord](https://discord.gg/terminagent) </div>