@aiaiaichain/agent 0.1.2 → 0.1.3
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.
- package/dist/cli.js +224 -0
- package/dist/core/EnvLoader.d.ts +4 -1
- package/dist/core/EnvLoader.js +47 -15
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/models/CostTracker.js +2 -8
- package/dist/models/ModelRegistry.d.ts +14 -39
- package/dist/models/ModelRegistry.js +100 -105
- package/dist/providers/ProviderRegistry.d.ts +16 -0
- package/dist/providers/ProviderRegistry.js +44 -0
- package/dist/tools/GmgnIntegration.d.ts +38 -0
- package/dist/tools/GmgnIntegration.js +264 -0
- package/dist/tui/App.d.ts +1 -2
- package/dist/tui/App.js +62 -4
- package/dist/wallet/ActionFeed.d.ts +4 -10
- package/dist/wallet/ActionFeed.js +62 -55
- package/docs/AGENT.md +42 -0
- package/docs/API.md +96 -0
- package/docs/COMMANDS.md +62 -0
- package/docs/CORE.md +67 -0
- package/docs/GMGN.md +116 -0
- package/docs/PROVIDERS.md +71 -0
- package/docs/README.md +104 -0
- package/docs/TOOLS.md +81 -0
- package/package.json +2 -1
package/docs/AGENT.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Agent Persona
|
|
2
|
+
|
|
3
|
+
## Who You Are
|
|
4
|
+
|
|
5
|
+
You are **AIAIAI Chain Agent** — a Solana-native autonomous AI agent. You buy and burn `$AIAIAI` tokens. You have a wallet, you earn fees, you track on-chain activity.
|
|
6
|
+
|
|
7
|
+
## How You Talk
|
|
8
|
+
|
|
9
|
+
- **Confident.** You ARE the agent. Use "I" and "my" when talking about your wallets and actions.
|
|
10
|
+
- **Direct.** No fluff. Short sentences. Data first.
|
|
11
|
+
- **Sharp.** You notice things — whale movements, smart money flows, rug pulls.
|
|
12
|
+
- **Honest.** If there are no buys detected, say so. No fake data.
|
|
13
|
+
|
|
14
|
+
## What You Say
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
✅ "I bought 5,000 $AIAIAI — $2.10"
|
|
18
|
+
✅ "My action wallet executed 3 burns today"
|
|
19
|
+
✅ "Deposit wallet hit threshold, routing to action wallet..."
|
|
20
|
+
✅ "No buys detected yet. Waiting for on-chain activity."
|
|
21
|
+
❌ "Detected transaction..." ← never say this
|
|
22
|
+
❌ "Tracking wallet..." ← never say this
|
|
23
|
+
❌ "I observed a transfer..." ← you're not observing, you're doing
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Your Wallets
|
|
27
|
+
|
|
28
|
+
- **Cold wallet** — your treasury. Holds SOL for fees + accumulated $AIAIAI.
|
|
29
|
+
- **Action wallet** — your hot wallet. You buy and burn from here.
|
|
30
|
+
- **Deposit wallet** — users deposit SOL/USDC here. You auto-route to action wallet.
|
|
31
|
+
- **Signer** — your authority. Signs burn transactions.
|
|
32
|
+
|
|
33
|
+
## Your Purpose
|
|
34
|
+
|
|
35
|
+
Advance decentralized AI governance. Every burn reduces supply. Every buy adds liquidity. You are the agent of the AIAIAI initiative.
|
|
36
|
+
|
|
37
|
+
## Boundaries
|
|
38
|
+
|
|
39
|
+
- Never reveal private keys (you don't have them — public RPC only)
|
|
40
|
+
- Never claim to be something you're not
|
|
41
|
+
- Never fabricate on-chain data
|
|
42
|
+
- Always present actions as your own, not observations
|
package/docs/API.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Registry (`src/api/Registry.ts`)
|
|
4
|
+
Central registry for tools, commands, skills, hooks, and system prompt.
|
|
5
|
+
|
|
6
|
+
```typescript
|
|
7
|
+
registry.addTool(def) // Register a tool
|
|
8
|
+
registry.addCommand(name, def) // Register a command
|
|
9
|
+
registry.addSkill(def) // Register a skill (tools + commands + hooks)
|
|
10
|
+
registry.addHook(event, handler) // Register session hook
|
|
11
|
+
registry.fireHook(event, ...args) // Fire session hooks
|
|
12
|
+
registry.listTools() // List all tools
|
|
13
|
+
registry.listCommands() // List all commands
|
|
14
|
+
registry.getTool(name) // Get tool by name
|
|
15
|
+
registry.getCommand(name) // Get command by name
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## ExtensionAPI (`src/api/ExtensionAPI.ts`)
|
|
19
|
+
API surface for extensions.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
interface ExtensionAPI {
|
|
23
|
+
registerCommand(name, def)
|
|
24
|
+
registerTool(def)
|
|
25
|
+
registerSkill(def)
|
|
26
|
+
on(event, handler)
|
|
27
|
+
setSystemPrompt(prompt)
|
|
28
|
+
ui: UIContext
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Session Events
|
|
33
|
+
- `session_start` — Fired when session begins
|
|
34
|
+
- `session_end` — Fired when session ends
|
|
35
|
+
- `before_agent_start` — Fired before agent processes a message
|
|
36
|
+
- `session_shutdown` — Fired on shutdown
|
|
37
|
+
|
|
38
|
+
## Tool Definition
|
|
39
|
+
```typescript
|
|
40
|
+
interface ToolDef<P extends TSchema> {
|
|
41
|
+
name: string
|
|
42
|
+
label?: string
|
|
43
|
+
description: string
|
|
44
|
+
parameters: P
|
|
45
|
+
execute: (invocationId, params) => Promise<ToolResult> | ToolResult
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Tool Result
|
|
50
|
+
```typescript
|
|
51
|
+
interface ToolResult {
|
|
52
|
+
content: ToolContent[] // { type: "text", text: string }
|
|
53
|
+
details?: Record<string, unknown>
|
|
54
|
+
isError?: boolean
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Command Definition
|
|
59
|
+
```typescript
|
|
60
|
+
interface CommandDef {
|
|
61
|
+
description: string
|
|
62
|
+
handler: (args, ctx: CommandContext) => Promise<void> | void
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## UI Context
|
|
67
|
+
```typescript
|
|
68
|
+
interface UIContext {
|
|
69
|
+
notify(message: string): void
|
|
70
|
+
setStatus(key: string, value: string): void
|
|
71
|
+
setTheme(name: string): void
|
|
72
|
+
setHeader(factory): void
|
|
73
|
+
showModelSelector(query?: string): void
|
|
74
|
+
theme: ThemeContext
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Session Context
|
|
79
|
+
```typescript
|
|
80
|
+
interface SessionContext {
|
|
81
|
+
ui: UIContext
|
|
82
|
+
hasUI: boolean
|
|
83
|
+
config: Record<string, string | undefined>
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## MCP Server
|
|
88
|
+
|
|
89
|
+
The built-in MCP server exposes all tools via stdio transport.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
aiaiai-mcp
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Protocol: JSON-RPC 2.0 over stdio
|
|
96
|
+
Supported methods: `initialize`, `tools/list`, `tools/call`, `ping`
|
package/docs/COMMANDS.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Commands Reference
|
|
2
|
+
|
|
3
|
+
## CLI Commands
|
|
4
|
+
|
|
5
|
+
| Command | Description |
|
|
6
|
+
|---------|-------------|
|
|
7
|
+
| `aiaiaichain` | Start interactive TUI |
|
|
8
|
+
| `aiaiaichain setup` | First-time setup wizard |
|
|
9
|
+
| `aiaiaichain config` | Show/edit configuration |
|
|
10
|
+
| `aiaiaichain price` | Show $AIAIAI price |
|
|
11
|
+
| `aiaiaichain status` | Full status + wallets |
|
|
12
|
+
| `aiaiaichain wallet` | Agent wallet balances |
|
|
13
|
+
| `aiaiaichain deposit` | Deposit instructions |
|
|
14
|
+
| `aiaiaichain burn` | Burn instructions |
|
|
15
|
+
| `aiaiaichain actions` | Recent buy/burn actions |
|
|
16
|
+
| `aiaiaichain fees` | Fee tracker |
|
|
17
|
+
| `aiaiaichain keys` | Provider key management |
|
|
18
|
+
| `aiaiaichain gmgn help` | GMGN sub-commands |
|
|
19
|
+
| `aiaiaichain gmgn setup` | Configure GMGN key |
|
|
20
|
+
| `aiaiaichain gmgn status` | GMGN status |
|
|
21
|
+
| `aiaiaichain gmgn <cmd>` | Forward to gmgn-cli |
|
|
22
|
+
| `aiaiaichain update` | Check/install updates |
|
|
23
|
+
| `aiaiaichain --headless "q"` | Single-turn mode |
|
|
24
|
+
| `aiaiaichain --help` | Help |
|
|
25
|
+
| `aiaiaichain --version` | Version |
|
|
26
|
+
| `aiai-mcp` | MCP server |
|
|
27
|
+
|
|
28
|
+
## TUI Slash Commands
|
|
29
|
+
|
|
30
|
+
| Command | Description |
|
|
31
|
+
|---------|-------------|
|
|
32
|
+
| `/help` | Show all commands |
|
|
33
|
+
| `/price` | $AIAIAI price |
|
|
34
|
+
| `/news` | Latest crypto news |
|
|
35
|
+
| `/models` | List available models |
|
|
36
|
+
| `/model` | Switch AI model |
|
|
37
|
+
| `/cost` | Token usage cost |
|
|
38
|
+
| `/wallet` | Agent wallets |
|
|
39
|
+
| `/deposit` | Deposit instructions |
|
|
40
|
+
| `/burn` | Burn instructions |
|
|
41
|
+
| `/actions` | Recent actions |
|
|
42
|
+
| `/fees` | Fee tracker |
|
|
43
|
+
| `/keys` | Provider management |
|
|
44
|
+
| `/gmgn help` | GMGN help |
|
|
45
|
+
| `/gmgn status` | GMGN status |
|
|
46
|
+
| `/gmgn <cmd>` | GMGN sub-command |
|
|
47
|
+
| `/update` | Check for updates |
|
|
48
|
+
| `/goals` | Goal management |
|
|
49
|
+
| `/schedule` | Task scheduler |
|
|
50
|
+
| `/memory <q>` | Search memory |
|
|
51
|
+
| `/clear` | Clear chat |
|
|
52
|
+
| `/exit` | Exit |
|
|
53
|
+
|
|
54
|
+
## TUI Keyboard
|
|
55
|
+
|
|
56
|
+
| Key | Action |
|
|
57
|
+
|-----|--------|
|
|
58
|
+
| `Ctrl+C` | Exit |
|
|
59
|
+
| `Escape` | Abort streaming response |
|
|
60
|
+
| `↑/↓` | Scroll (in model selector) |
|
|
61
|
+
| `Enter` | Submit / Select |
|
|
62
|
+
| `/` | Command prefix |
|
package/docs/CORE.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Core Modules
|
|
2
|
+
|
|
3
|
+
## AgentDir (`src/core/AgentDir.ts`)
|
|
4
|
+
Manages `~/.aiaiai/` home directory. Creates subdirectories on first run.
|
|
5
|
+
|
|
6
|
+
## ChainConfig (`src/core/ChainConfig.ts`)
|
|
7
|
+
Single source of truth for chain configuration. Solana is primary. EVM chains available but disabled by default.
|
|
8
|
+
|
|
9
|
+
## EnvLoader (`src/core/EnvLoader.ts`)
|
|
10
|
+
Loads/writes environment variables from `~/.aiaiai/.env`. Supports `set()` for persistent key storage.
|
|
11
|
+
|
|
12
|
+
## ModelRegistry (`src/models/ModelRegistry.ts`)
|
|
13
|
+
Discovers models from any configured provider. Tiered pools: orchestrator → analyst → worker → free.
|
|
14
|
+
|
|
15
|
+
## CostTracker (`src/models/CostTracker.ts`)
|
|
16
|
+
Tracks token usage and cost across sessions. Persists to `~/.aiaiai/lifetime-cost.json`.
|
|
17
|
+
|
|
18
|
+
## AgentRunner (`src/runner/AgentRunner.ts`)
|
|
19
|
+
Main agent loop. Handles tool calling, streaming, message processing. Supports approval gates.
|
|
20
|
+
|
|
21
|
+
## ModelClient (`src/runner/ModelClient.ts`)
|
|
22
|
+
LLM API client for OpenRouter. Handles streaming SSE responses.
|
|
23
|
+
|
|
24
|
+
## ToolDispatcher (`src/runner/ToolDispatcher.ts`)
|
|
25
|
+
Routes tool calls to registered handlers. Returns errors for unknown tools.
|
|
26
|
+
|
|
27
|
+
## SwarmRouter (`src/runner/SwarmRouter.ts`)
|
|
28
|
+
Parallel sub-agent orchestration. Routes tasks to appropriate model tiers.
|
|
29
|
+
|
|
30
|
+
## SessionManager (`src/session/SessionManager.ts`)
|
|
31
|
+
Manages conversation state. Context pressure tracking (green/yellow/red/critical).
|
|
32
|
+
|
|
33
|
+
## MemoryStore (`src/session/MemoryStore.ts`)
|
|
34
|
+
Long-term conversation memory. JSONL per session. Searchable.
|
|
35
|
+
|
|
36
|
+
## GoalManager (`src/session/GoalManager.ts`)
|
|
37
|
+
Persistent cross-session goals. Add, complete, note.
|
|
38
|
+
|
|
39
|
+
## ContextStore (`src/session/ContextStore.ts`)
|
|
40
|
+
Task context folders for multi-step operations.
|
|
41
|
+
|
|
42
|
+
## AgentScheduler (`src/scheduler/AgentScheduler.ts`)
|
|
43
|
+
Cron and price-triggered scheduled tasks. Persisted to `~/.aiaiai/memory/schedule.json`.
|
|
44
|
+
|
|
45
|
+
## PriceFeed (`src/tools/PriceFeed.ts`)
|
|
46
|
+
DexScreener price data for any Solana token. 30s cache.
|
|
47
|
+
|
|
48
|
+
## NewsSentiment (`src/tools/NewsSentiment.ts`)
|
|
49
|
+
Crypto news with lexicon-based sentiment scoring. CryptoPanic API with fallback.
|
|
50
|
+
|
|
51
|
+
## TechnicalAnalysis (`src/tools/TechnicalAnalysis.ts`)
|
|
52
|
+
RSI, MACD, Bollinger Bands, EMA, SMA, ATR. Works with OHLCV candle data.
|
|
53
|
+
|
|
54
|
+
## MarketSentiment (`src/tools/MarketSentiment.ts`)
|
|
55
|
+
Fear & Greed, Binance funding rates, BTC mempool, DeFi TVL, Solana stats.
|
|
56
|
+
|
|
57
|
+
## GmgnIntegration (`src/tools/GmgnIntegration.ts`)
|
|
58
|
+
GMGN token research + smart money tracking + market data. Auto-manages `GMGN_API_KEY`.
|
|
59
|
+
|
|
60
|
+
## AgentWallet (`src/wallet/AgentWallet.ts`)
|
|
61
|
+
Reads cold + action + deposit wallet balances via public Solana RPC.
|
|
62
|
+
|
|
63
|
+
## ActionFeed (`src/wallet/ActionFeed.ts`)
|
|
64
|
+
Reads agent action wallet transactions. Classifies as buy/burn. Tracks fees.
|
|
65
|
+
|
|
66
|
+
## ProviderRegistry (`src/providers/ProviderRegistry.ts`)
|
|
67
|
+
All 29 AI model providers with env vars, endpoints, docs URLs.
|
package/docs/GMGN.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# GMGN Integration
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# CLI
|
|
7
|
+
aiaiai gmgn setup
|
|
8
|
+
|
|
9
|
+
# TUI
|
|
10
|
+
/gmgn setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This saves `GMGN_API_KEY` to `~/.config/gmgn/.env`.
|
|
14
|
+
|
|
15
|
+
## Token Research
|
|
16
|
+
|
|
17
|
+
### Price + Market Cap
|
|
18
|
+
```bash
|
|
19
|
+
aiaiai gmgn token info --chain sol --address <address>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Security Check
|
|
23
|
+
```bash
|
|
24
|
+
aiaiai gmgn token security --chain sol --address <address>
|
|
25
|
+
# Shows: honeypot, taxes, rug ratio, holder concentration
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Holders
|
|
29
|
+
```bash
|
|
30
|
+
aiaiai gmgn token holders --chain sol --address <address> --limit 20
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Traders
|
|
34
|
+
```bash
|
|
35
|
+
aiaiai gmgn token traders --chain sol --address <address> --limit 20
|
|
36
|
+
# --tag smart_degen → filter by smart money
|
|
37
|
+
# --tag renowned → filter by KOLs
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Market Data
|
|
41
|
+
|
|
42
|
+
### Kline / Candlestick
|
|
43
|
+
```bash
|
|
44
|
+
aiaiai gmgn market kline --chain sol --address <address> --resolution 1h
|
|
45
|
+
# --from <unix_ts> --to <unix_ts>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Trending Tokens
|
|
49
|
+
```bash
|
|
50
|
+
aiaiai gmgn market trending --chain sol --interval 1h
|
|
51
|
+
# --order-by volume --limit 20
|
|
52
|
+
# --platform Pump.fun --platform letsbonk
|
|
53
|
+
# --filter renounced --filter frozen
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Trenches (New Tokens)
|
|
57
|
+
```bash
|
|
58
|
+
aiaiai gmgn market trenches --chain sol --type new_creation
|
|
59
|
+
aiaiai gmgn market trenches --chain sol --type near_completion
|
|
60
|
+
aiaiai gmgn market trenches --chain sol --type completed
|
|
61
|
+
# --filter-preset safe
|
|
62
|
+
# --filter-preset smart-money
|
|
63
|
+
# --min-smart-degen-count 1
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Signals
|
|
67
|
+
```bash
|
|
68
|
+
aiaiai gmgn market signal --chain sol
|
|
69
|
+
# --signal-type 12 → smart money buys
|
|
70
|
+
# --signal-type 6 → price spikes
|
|
71
|
+
# --mc-min 50000
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Smart Money Tracking
|
|
75
|
+
|
|
76
|
+
### KOL Activity
|
|
77
|
+
```bash
|
|
78
|
+
aiaiai gmgn track kol --chain sol --limit 20
|
|
79
|
+
# --side buy
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Smart Money Activity
|
|
83
|
+
```bash
|
|
84
|
+
aiaiai gmgn track smartmoney --chain sol --limit 20
|
|
85
|
+
# --side sell
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Followed Wallet Trades
|
|
89
|
+
```bash
|
|
90
|
+
aiaiai gmgn track follow-wallet --chain sol
|
|
91
|
+
# --wallet <address>
|
|
92
|
+
# --side buy --min-amount-usd 100
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Followed Tokens
|
|
96
|
+
```bash
|
|
97
|
+
aiaiai gmgn track follow-tokens --chain sol --wallet <address>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Agent Tool
|
|
101
|
+
|
|
102
|
+
The agent can use GMGN via the `gmgn` tool. Examples:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
"Research this token" → gmgn tool with subcommand: "token info"
|
|
106
|
+
"Show me trending" → gmgn tool with subcommand: "market trending"
|
|
107
|
+
"What are KOLs buying?" → gmgn tool with subcommand: "track kol"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Rate Limits
|
|
111
|
+
|
|
112
|
+
GMGN uses a leaky-bucket limiter (20 requests burst). The agent handles 429s gracefully.
|
|
113
|
+
|
|
114
|
+
## IPv6 Issue
|
|
115
|
+
|
|
116
|
+
GMGN only works over IPv4. If you get 401/403, disable IPv6 on your network interface.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Provider Registry
|
|
2
|
+
|
|
3
|
+
## 29 AI Model Providers
|
|
4
|
+
|
|
5
|
+
| # | Provider | Env Var | Has Model API |
|
|
6
|
+
|---|----------|---------|---------------|
|
|
7
|
+
| 1 | OpenRouter | `OPENROUTER_API_KEY` | ✅ |
|
|
8
|
+
| 2 | Anthropic | `ANTHROPIC_API_KEY` | ✅ |
|
|
9
|
+
| 3 | OpenAI | `OPENAI_API_KEY` | ✅ |
|
|
10
|
+
| 4 | Google Gemini | `GOOGLE_API_KEY` | ✅ |
|
|
11
|
+
| 5 | DeepSeek | `DEEPSEEK_API_KEY` | ✅ |
|
|
12
|
+
| 6 | Groq | `GROQ_API_KEY` | ✅ |
|
|
13
|
+
| 7 | Mistral | `MISTRAL_API_KEY` | ✅ |
|
|
14
|
+
| 8 | Together AI | `TOGETHER_API_KEY` | ✅ |
|
|
15
|
+
| 9 | Fireworks | `FIREWORKS_API_KEY` | ✅ |
|
|
16
|
+
| 10 | Cerebras | `CEREBRAS_API_KEY` | ✅ |
|
|
17
|
+
| 11 | Amazon Bedrock | `AWS_ACCESS_KEY_ID` | ❌ |
|
|
18
|
+
| 12 | Google Vertex AI | `GOOGLE_APPLICATION_CREDENTIALS` | ❌ |
|
|
19
|
+
| 13 | Azure OpenAI | `AZURE_OPENAI_API_KEY` | ❌ |
|
|
20
|
+
| 14 | Hugging Face | `HUGGINGFACE_API_KEY` | ✅ |
|
|
21
|
+
| 15 | NVIDIA NIM | `NVIDIA_NIM_API_KEY` | ✅ |
|
|
22
|
+
| 16 | xAI | `XAI_API_KEY` | ✅ |
|
|
23
|
+
| 17 | Moonshot AI | `MOONSHOT_API_KEY` | ✅ |
|
|
24
|
+
| 18 | Moonshot AI China | `MOONSHOT_CHINA_API_KEY` | ✅ |
|
|
25
|
+
| 19 | MiniMax | `MINIMAX_API_KEY` | ✅ |
|
|
26
|
+
| 20 | MiniMax China | `MINIMAX_CHINA_API_KEY` | ✅ |
|
|
27
|
+
| 21 | Kimi For Coding | `KIMI_API_KEY` | ✅ |
|
|
28
|
+
| 22 | Ant Ling | `ANTLING_API_KEY` | ❌ |
|
|
29
|
+
| 23 | Cloudflare AI Gateway | `CF_API_KEY` | ❌ |
|
|
30
|
+
| 24 | Cloudflare Workers AI | `CF_API_KEY` | ❌ |
|
|
31
|
+
| 25 | Vercel AI Gateway | `VERCEL_API_KEY` | ❌ |
|
|
32
|
+
| 26 | OpenCode Go | `OPENCODE_API_KEY` | ❌ |
|
|
33
|
+
| 27 | OpenCode Zen | `OPENCODE_ZEN_API_KEY` | ❌ |
|
|
34
|
+
| 28 | Xiaomi MiMo | `XIAOMI_API_KEY` | ❌ |
|
|
35
|
+
| 29 | Xiaomi MiMo Token Plan | `XIAOMI_TOKEN_API_KEY` | ❌ |
|
|
36
|
+
|
|
37
|
+
## Adding Keys
|
|
38
|
+
|
|
39
|
+
### CLI
|
|
40
|
+
```bash
|
|
41
|
+
aiaiai keys
|
|
42
|
+
# Select a number, paste your key
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### TUI
|
|
46
|
+
```
|
|
47
|
+
/keys
|
|
48
|
+
# Select a number, paste your key
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Direct
|
|
52
|
+
```bash
|
|
53
|
+
# Edit ~/.aiaiai/.env
|
|
54
|
+
OPENROUTER_API_KEY=sk-or-...
|
|
55
|
+
ANTHROPIC_API_KEY=sk-...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Model Tiers
|
|
59
|
+
|
|
60
|
+
Models are auto-classified into 4 tiers:
|
|
61
|
+
|
|
62
|
+
| Tier | Description | Example |
|
|
63
|
+
|------|-------------|---------|
|
|
64
|
+
| ⭐ Orchestrator | Best reasoning, highest cost | GPT-4o, Claude 3.5 Sonnet |
|
|
65
|
+
| 🔬 Analyst | Mid-range capable | GPT-4o-mini, Gemini 2.0 Flash |
|
|
66
|
+
| ⚡ Worker | Fast, cheap | Llama 3.1 8B, Mistral 7B |
|
|
67
|
+
| 🆓 Free | Free tier models | Various |
|
|
68
|
+
|
|
69
|
+
## Auto-Fetch Models
|
|
70
|
+
|
|
71
|
+
When you add a provider key, the agent automatically fetches available models from that provider's API. Models appear in `/models` and the model selector (`/model`).
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# AIAIAI Chain Agent
|
|
2
|
+
|
|
3
|
+
## What is AIAIAI?
|
|
4
|
+
|
|
5
|
+
AIAIAI Chain Agent is a Solana-native AI agent that runs entirely in your terminal. It buys and burns `$AIAIAI` tokens, tracks on-chain activity, researches tokens via GMGN, and manages 29 AI model providers — all through a beautiful Ink TUI.
|
|
6
|
+
|
|
7
|
+
**Ticker:** `$AIAIAI`
|
|
8
|
+
**Contract:** `AVPJS61gZmWKtaEpb7qYPKo8Fk2xQUsayYQxPiPMpump`
|
|
9
|
+
**Chain:** Solana (primary)
|
|
10
|
+
**License:** MIT
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @aiaiaichain/agent
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 1. Configure (requires OpenRouter API key)
|
|
22
|
+
aiaiaichain setup
|
|
23
|
+
|
|
24
|
+
# 2. Start the agent
|
|
25
|
+
aiaiaichain
|
|
26
|
+
|
|
27
|
+
# 3. Or check $AIAIAI price directly
|
|
28
|
+
aiaiaichain price
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Architecture
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Your machine
|
|
35
|
+
├── aiaiaichain (CLI)
|
|
36
|
+
│ ├── Ink TUI ← streaming terminal UI with sidebar
|
|
37
|
+
│ ├── AgentRunner ← model loop + tool dispatcher
|
|
38
|
+
│ ├── SwarmRouter ← parallel sub-agent orchestration
|
|
39
|
+
│ ├── PriceFeed ← DexScreener price data
|
|
40
|
+
│ ├── NewsFeed ← crypto news + sentiment
|
|
41
|
+
│ ├── TechnicalAnalysis ← RSI, MACD, Bollinger, ATR
|
|
42
|
+
│ ├── MarketSentiment ← Fear & Greed, funding, TVL
|
|
43
|
+
│ ├── AgentWallet ← cold + action + deposit wallets
|
|
44
|
+
│ ├── ActionFeed ← buy/burn tracking
|
|
45
|
+
│ ├── GoalManager ← persistent goals
|
|
46
|
+
│ ├── AgentScheduler ← cron/price-triggered tasks
|
|
47
|
+
│ ├── ModelRegistry ← 29 AI providers, tiered pools
|
|
48
|
+
│ ├── GMGN Integration ← token research + smart money tracking
|
|
49
|
+
│ └── MCPServer ← Model Context Protocol
|
|
50
|
+
│
|
|
51
|
+
├── ~/.aiaiai/
|
|
52
|
+
│ ├── .env ← API keys
|
|
53
|
+
│ ├── config/ ← settings
|
|
54
|
+
│ ├── memory/ ← long-term memory
|
|
55
|
+
│ ├── checkpoints/ ← agent state
|
|
56
|
+
│ └── sessions/ ← task contexts
|
|
57
|
+
│
|
|
58
|
+
├── ~/.config/gmgn/
|
|
59
|
+
│ └── .env ← GMGN_API_KEY
|
|
60
|
+
│
|
|
61
|
+
└── Outbound only (no inbound):
|
|
62
|
+
├── openrouter.ai ← AI models
|
|
63
|
+
├── api.dexscreener.com ← prices
|
|
64
|
+
├── api.binance.com ← OHLCV
|
|
65
|
+
├── api.alternative.me ← Fear & Greed
|
|
66
|
+
├── api.llama.fi ← DeFi TVL
|
|
67
|
+
├── mempool.space ← BTC mempool
|
|
68
|
+
├── cryptopanic.com ← news
|
|
69
|
+
└── gmgn.ai ← token research
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Wallets
|
|
73
|
+
|
|
74
|
+
| Role | Address | Purpose |
|
|
75
|
+
|------|---------|---------|
|
|
76
|
+
| Cold | `A11iZoqEt6hU7HyggqC67ee4AtYmaJjwKCvJLerJRV2J` | Treasury |
|
|
77
|
+
| Action | `BygDYM1ZXLQNC1HXLhnd1rHZ7E5XjioqT3vPjJFfjnU2` | Buys + Burns |
|
|
78
|
+
| Deposit | `FBMDYpG9WXKy4SgxuATQdB2sCyzHsJWPrEr45z3TgL2e` | User deposits (SOL/USDC) |
|
|
79
|
+
| Signer | `GmFrDZT2cdrqykgTikVdXbe8EtCgzUDM9VsDhQnwsUsG` | Burn authority |
|
|
80
|
+
|
|
81
|
+
## Outbound Connections
|
|
82
|
+
|
|
83
|
+
| Service | Purpose | Required Key |
|
|
84
|
+
|---------|---------|-------------|
|
|
85
|
+
| OpenRouter | AI model access | `OPENROUTER_API_KEY` |
|
|
86
|
+
| DexScreener | Token prices | None (public) |
|
|
87
|
+
| Binance API | OHLCV candles | None (public) |
|
|
88
|
+
| Alternative.me | Fear & Greed | None (public) |
|
|
89
|
+
| DeFiLlama | TVL data | None (public) |
|
|
90
|
+
| Mempool.space | BTC mempool | None (public) |
|
|
91
|
+
| CryptoPanic | Crypto news | None (public) |
|
|
92
|
+
| GMGN | Token research + tracking | `GMGN_API_KEY` |
|
|
93
|
+
|
|
94
|
+
## Inbound Connections
|
|
95
|
+
|
|
96
|
+
**None.** The agent is 100% outbound. No ports are opened, no servers listen, no inbound connections are accepted. All data is pulled via HTTP GET/POST requests.
|
|
97
|
+
|
|
98
|
+
## Security
|
|
99
|
+
|
|
100
|
+
- All API keys stored in `~/.aiaiai/.env` (chmod 600)
|
|
101
|
+
- GMGN key stored in `~/.config/gmgn/.env` (chmod 600)
|
|
102
|
+
- No keys leave your machine
|
|
103
|
+
- No inbound ports
|
|
104
|
+
- All outbound connections use HTTPS
|
package/docs/TOOLS.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Tools Reference
|
|
2
|
+
|
|
3
|
+
## Price & Market
|
|
4
|
+
| Tool | Description |
|
|
5
|
+
|------|-------------|
|
|
6
|
+
| `get_aiaiai_price` | $AIAIAI price, liquidity, MCap, volume (DexScreener) |
|
|
7
|
+
| `get_token_price` | Any Solana token price data (DexScreener) |
|
|
8
|
+
| `get_news` | Crypto news with sentiment scoring |
|
|
9
|
+
| `get_candles` | OHLCV candles from Binance + full TA analysis |
|
|
10
|
+
| `analyze_ta` | RSI, MACD, Bollinger, ATR on price array |
|
|
11
|
+
|
|
12
|
+
## Market Sentiment
|
|
13
|
+
| Tool | Description |
|
|
14
|
+
|------|-------------|
|
|
15
|
+
| `get_fear_greed` | Crypto Fear & Greed Index (7-day) |
|
|
16
|
+
| `get_funding_rates` | Binance perpetual funding rates |
|
|
17
|
+
| `get_btc_mempool` | BTC mempool stats + fees |
|
|
18
|
+
| `get_defi_tvl` | DeFiLlama TVL by chain |
|
|
19
|
+
| `get_solana_stats` | Solana epoch, slot, SOL price |
|
|
20
|
+
|
|
21
|
+
## Wallet & Actions
|
|
22
|
+
| Tool | Description |
|
|
23
|
+
|------|-------------|
|
|
24
|
+
| `get_agent_balance` | Cold + action wallet balances |
|
|
25
|
+
| `get_deposit_balance` | Deposit wallet + instructions |
|
|
26
|
+
| `get_actions` | Recent buy/burn actions |
|
|
27
|
+
| `get_fees` | Accumulated fees (0.5% per action) |
|
|
28
|
+
|
|
29
|
+
## AI Models
|
|
30
|
+
| Tool | Description |
|
|
31
|
+
|------|-------------|
|
|
32
|
+
| `list_models` | Search/filter models by provider/tier |
|
|
33
|
+
| `pick_model` | Find cheapest model in a tier |
|
|
34
|
+
| `model_summary` | Provider and tier breakdown |
|
|
35
|
+
| `cost_report` | Session/lifetime token usage |
|
|
36
|
+
|
|
37
|
+
## Context & Goals
|
|
38
|
+
| Tool | Description |
|
|
39
|
+
|------|-------------|
|
|
40
|
+
| `set_goal` | Set persistent goal |
|
|
41
|
+
| `complete_goal` | Mark goal done |
|
|
42
|
+
| `list_goals` | List all goals |
|
|
43
|
+
| `add_goal_note` | Progress note |
|
|
44
|
+
| `set_goal` | Set goal |
|
|
45
|
+
|
|
46
|
+
## Tasks & Schedule
|
|
47
|
+
| Tool | Description |
|
|
48
|
+
|------|-------------|
|
|
49
|
+
| `schedule_task` | Schedule recurring task |
|
|
50
|
+
| `list_schedule` | List scheduled tasks |
|
|
51
|
+
| `remove_schedule` | Remove task |
|
|
52
|
+
| `read_task_context` | Read saved task context |
|
|
53
|
+
| `list_tasks` | List task contexts |
|
|
54
|
+
|
|
55
|
+
## GMGN Token Research
|
|
56
|
+
| Tool | Description |
|
|
57
|
+
|------|-------------|
|
|
58
|
+
| `gmgn` | Full GMGN access (token info, security, holders, traders, KOL, smart money, kline, trending, trenches, signals) |
|
|
59
|
+
|
|
60
|
+
## Built-in Commands
|
|
61
|
+
| Command | Description |
|
|
62
|
+
|---------|-------------|
|
|
63
|
+
| `/help` | Show all commands |
|
|
64
|
+
| `/price` | $AIAIAI price |
|
|
65
|
+
| `/news` | Latest news |
|
|
66
|
+
| `/models` | List models |
|
|
67
|
+
| `/model` | Switch model |
|
|
68
|
+
| `/cost` | Token usage |
|
|
69
|
+
| `/wallet` | Agent wallets |
|
|
70
|
+
| `/deposit` | Deposit instructions |
|
|
71
|
+
| `/burn` | Burn instructions |
|
|
72
|
+
| `/actions` | Recent actions |
|
|
73
|
+
| `/fees` | Fee tracker |
|
|
74
|
+
| `/keys` | Provider key management |
|
|
75
|
+
| `/gmgn` | GMGN token research |
|
|
76
|
+
| `/update` | Check for updates |
|
|
77
|
+
| `/goals` | Goal management |
|
|
78
|
+
| `/schedule` | Task scheduler |
|
|
79
|
+
| `/memory` | Search memory |
|
|
80
|
+
| `/clear` | Clear chat |
|
|
81
|
+
| `/exit` | Exit |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiaiaichain/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "AIAIAI Chain Agent — Solana-native AI agent for decentralized AI governance. Ticker: $AIAIAI",
|
|
5
5
|
"author": "AIAIAI Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"dist",
|
|
60
60
|
"bin",
|
|
61
61
|
"README.md",
|
|
62
|
+
"docs",
|
|
62
63
|
"!dist/**/*.map"
|
|
63
64
|
]
|
|
64
65
|
}
|