@emblemvault/agentwallet 1.3.1 → 3.0.0

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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @emblemvault/agentwallet
2
2
 
3
- CLI for **Agent Hustle** - EmblemVault's autonomous crypto AI with 256+ trading tools across 7 blockchains.
3
+ The CLI for **EmblemVault Agent Wallet** -- giving AI agents their own crypto wallets across 7 blockchains. Designed for use in [OpenClaw](https://openclaw.ai), autonomous agent frameworks, and any system where AI agents need to hold, send, and manage crypto independently.
4
+
5
+ Each agent gets a deterministic wallet derived from a password. No seed phrases, no manual key management. The agent authenticates once and gets addresses on Solana, Ethereum, Base, BSC, Polygon, Hedera, and Bitcoin -- ready to trade, hold, and transact.
4
6
 
5
7
  ## Install
6
8
 
@@ -8,31 +10,96 @@ CLI for **Agent Hustle** - EmblemVault's autonomous crypto AI with 256+ trading
8
10
  npm install -g @emblemvault/agentwallet
9
11
  ```
10
12
 
11
- ## Usage
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Agent mode -- give your AI agent a wallet (auto-generates credentials on first run)
17
+ emblemai --agent -m "What are my wallet addresses?"
18
+
19
+ # Agent mode with a specific wallet identity
20
+ emblemai --agent -p "my-agent-password-here" -m "Show my balances across all chains"
21
+
22
+ # Interactive mode -- opens browser for human authentication
23
+ emblemai
24
+ ```
25
+
26
+ ## Authentication
27
+
28
+ EmblemAI v3 supports two authentication methods:
29
+
30
+ ### Browser Auth (Interactive Mode)
31
+
32
+ When you run `emblemai` without `-p`, the CLI:
33
+
34
+ 1. Checks for a saved session in `~/.emblemai/session.json`
35
+ 2. If no valid session, opens your browser to authenticate via the EmblemVault auth modal
36
+ 3. Captures the JWT session and saves it locally
37
+ 4. On subsequent runs, restores the saved session automatically (no login needed until it expires)
38
+
39
+ If the browser fails to open, the URL is printed for manual copy-paste. If authentication times out (5 minutes), falls back to password prompt.
40
+
41
+ ### Password Auth (Agent Mode)
42
+
43
+ Agent mode always uses password authentication:
44
+
45
+ - Auto-generates a secure password on first run if none provided
46
+ - Password is stored encrypted via dotenvx in `~/.emblemai/.env`
47
+ - Use `-p` flag to provide a specific password
48
+
49
+ **Login and signup are the same action.** The first use of a password creates a vault; subsequent uses return the same vault. Different passwords produce different wallets.
50
+
51
+ - Password must be 16+ characters
52
+ - No recovery if lost (treat it like a private key)
53
+
54
+ ## Operating Modes
55
+
56
+ ### Interactive Mode (Default)
57
+
58
+ Readline-based interactive mode with streaming AI responses, glow markdown rendering, and slash commands.
59
+
60
+ ```bash
61
+ emblemai # Browser auth (recommended)
62
+ emblemai -p "your-password" # Password auth
63
+ ```
64
+
65
+ ### Agent Mode
12
66
 
13
- ### Agent Mode (For AI Agents)
67
+ Agent mode is the primary integration point for AI agents, automation scripts, and agent frameworks like OpenClaw. It sends a single message, prints the response to stdout, and exits -- designed for programmatic use where another system is orchestrating the agent.
14
68
 
15
- Single-shot queries that return a response and exit:
69
+ **Zero-config setup**: On first run without a password, agent mode auto-generates a secure password and stores it encrypted. The agent gets a wallet immediately with no human intervention.
16
70
 
17
71
  ```bash
18
- # Query Hustle AI
19
- emblemai --agent -p "your-password-16-chars-min" -m "What are my wallet addresses?"
72
+ # First run -- auto-generates password, creates wallet, answers query
73
+ emblemai --agent -m "What are my wallet addresses?"
74
+
75
+ # Explicit password -- use when you need a specific wallet identity
76
+ emblemai --agent -p "your-password" -m "Show my balances"
77
+
78
+ # Pipe output to other tools
79
+ emblemai -a -m "What is my SOL balance?" | jq .
20
80
 
21
- # Using environment variable
22
- export EMBLEM_PASSWORD="your-password-16-chars-min"
23
- emblemai --agent -p "$EMBLEM_PASSWORD" -m "Show my balances"
81
+ # Use in scripts
82
+ ADDRESSES=$(emblemai -a -m "List my addresses as JSON")
24
83
  ```
25
84
 
26
- ### Interactive Mode (For Humans)
85
+ Agent mode always uses password auth (never browser auth), retains conversation history between calls, and supports the full Hustle AI toolset including trading, transfers, portfolio queries, and cross-chain operations.
27
86
 
28
- Full interactive CLI with streaming, tools, and auth menu:
87
+ #### Integrating with Agent Frameworks
88
+
89
+ Any system that can shell out to a CLI can give its agents a wallet:
29
90
 
30
91
  ```bash
31
- # With password argument
32
- emblemai -p "your-password-16-chars-min"
92
+ # OpenClaw, CrewAI, AutoGPT, or any agent framework
93
+ emblemai --agent -m "Send 0.1 SOL to <address>"
94
+ emblemai --agent -m "Swap 100 USDC to ETH on Base"
95
+ emblemai --agent -m "What tokens do I hold across all chains?"
96
+ ```
33
97
 
34
- # Or let it prompt for password
35
- emblemai
98
+ Each password produces a unique, deterministic wallet. To give multiple agents separate wallets, use different passwords:
99
+
100
+ ```bash
101
+ emblemai --agent -p "agent-alice-wallet-001" -m "My addresses?"
102
+ emblemai --agent -p "agent-bob-wallet-002" -m "My addresses?"
36
103
  ```
37
104
 
38
105
  ### Reset Conversation
@@ -41,58 +108,104 @@ emblemai
41
108
  emblemai --reset
42
109
  ```
43
110
 
111
+ ## CLI Flags
112
+
113
+ | Flag | Description |
114
+ |------|-------------|
115
+ | `-p`, `--password <pw>` | EmblemVault password (min 16 chars) -- skips browser auth |
116
+ | `-m`, `--message <msg>` | Message to send (agent mode) |
117
+ | `-a`, `--agent` | Agent mode (single message, exit) |
118
+ | `--restore-auth <path>` | Restore credentials from a backup file and exit |
119
+ | `--debug` | Enable debug output |
120
+ | `--stream` | Toggle streaming (default: on) |
121
+ | `--log` | Enable stream logging |
122
+ | `--log-file <path>` | Override log file path |
123
+ | `--reset` | Clear conversation history |
124
+ | `--hustle-url <url>` | Override Hustle API endpoint |
125
+ | `--auth-url <url>` | Override auth endpoint |
126
+ | `--api-url <url>` | Override API endpoint |
127
+
128
+ ## Environment Variables
129
+
130
+ | Variable | Description |
131
+ |----------|-------------|
132
+ | `EMBLEM_PASSWORD` | Password (alternative to `-p`) |
133
+ | `HUSTLE_API_URL` | Hustle API endpoint override |
134
+ | `EMBLEM_AUTH_URL` | Auth endpoint override |
135
+ | `EMBLEM_API_URL` | API endpoint override |
136
+ | `ELIZA_URL` | ElizaOS URL for inverse discovery |
137
+
44
138
  ## Interactive Commands
45
139
 
46
140
  | Command | Description |
47
141
  |---------|-------------|
48
142
  | `/help` | Show all commands |
49
- | `/settings` | Show current config |
50
- | `/auth` | Open auth menu (API key, addresses, etc.) |
51
- | `/stream on\|off` | Toggle streaming mode |
143
+ | `/plugins` | List all plugins with status |
144
+ | `/plugin <name> on\|off` | Toggle a plugin |
145
+ | `/tools` | List available tools |
146
+ | `/tools add\|remove <id>` | Manage tool selection |
147
+ | `/tools clear` | Enable auto-tools mode |
148
+ | `/auth` | Authentication menu (session info, addresses, backup, logout) |
149
+ | `/wallet` | Show wallet addresses |
150
+ | `/portfolio` | Show portfolio |
151
+ | `/settings` | Show current settings |
152
+ | `/model <id>` | Set AI model (or `clear` to reset) |
153
+ | `/stream on\|off` | Toggle streaming |
52
154
  | `/debug on\|off` | Toggle debug mode |
53
155
  | `/history on\|off` | Toggle history retention |
54
- | `/reset` | Clear conversation history |
55
- | `/models` | List available models |
56
- | `/model <id>` | Set model |
57
- | `/tools` | List tool categories |
58
- | `/tools add\|remove <id>` | Manage tools |
59
- | `/exit` | Exit the CLI |
156
+ | `/payment` | PAYG billing status |
157
+ | `/payment enable\|disable` | Toggle PAYG billing |
158
+ | `/payment token <T>` | Set payment token |
159
+ | `/payment mode <M>` | Set payment mode |
160
+ | `/secrets` | Manage encrypted plugin secrets |
161
+ | `/glow on\|off` | Toggle glow markdown rendering |
162
+ | `/log on\|off` | Toggle stream logging |
163
+ | `/reset` | Clear conversation |
164
+ | `/exit` | Exit |
60
165
 
61
- ## Example Queries
166
+ ## Auth Backup and Restore
167
+
168
+ The `/auth` menu includes a **Backup Agent Auth** option that exports your credentials to a single JSON file. To restore on another machine:
62
169
 
63
170
  ```bash
64
- # Check wallet addresses
65
- emblemai --agent -p "$PASSWORD" -m "What are my wallet addresses?"
171
+ emblemai --restore-auth ~/emblemai-auth-backup.json
172
+ ```
66
173
 
67
- # Check balances
68
- emblemai --agent -p "$PASSWORD" -m "Show all my balances across all chains"
174
+ This places the credential files in `~/.emblemai/` and you're ready to go.
69
175
 
70
- # Swap tokens
71
- emblemai --agent -p "$PASSWORD" -m "Swap $20 worth of SOL to USDC"
176
+ ## Plugins
72
177
 
73
- # Market trends
74
- emblemai --agent -p "$PASSWORD" -m "What's trending on Solana right now?"
75
- ```
178
+ The ElizaOS plugin is loaded by default:
76
179
 
77
- ## Authentication
180
+ | Plugin | Package | Description |
181
+ |--------|---------|-------------|
182
+ | ElizaOS | `@agenthustle/plugin-masq` | ElizaOS agent framework with MASQ and inverse discovery |
78
183
 
79
- **Login and signup are the same action.**
184
+ Additional plugins exist but are currently disabled. See [docs/PLUGINS.md](docs/PLUGINS.md) for details.
80
185
 
81
- | Scenario | What Happens |
82
- |----------|--------------|
83
- | First time with a password | Creates a new vault with unique addresses |
84
- | Same password again | Returns the same vault (deterministic) |
85
- | Different password | Creates a completely different vault |
186
+ ## Optional: Glow (Markdown Rendering)
86
187
 
87
- - Password must be 16+ characters
88
- - No recovery if lost (treat it like a private key)
188
+ Install [glow](https://github.com/charmbracelet/glow) for rich markdown rendering in AI responses:
189
+
190
+ ```bash
191
+ brew install glow # macOS
192
+ sudo snap install glow # Linux
193
+ ```
194
+
195
+ Toggle with `/glow on|off`.
89
196
 
90
197
  ## Supported Chains
91
198
 
92
199
  Solana, Ethereum, Base, BSC, Polygon, Hedera, Bitcoin
93
200
 
201
+ ## Documentation
202
+
203
+ - [Setup Guide](docs/SETUP.md) -- installation, auth, running modes
204
+ - [Commands](docs/COMMANDS.md) -- full command reference
205
+ - [Plugins](docs/PLUGINS.md) -- plugin system and tool reference
206
+
94
207
  ## Links
95
208
 
96
209
  - [EmblemVault](https://emblemvault.dev)
97
210
  - [Hustle AI](https://agenthustle.ai)
98
- - [OpenClaw Skill](https://github.com/EmblemCompany/EmblemAi-AgentWallet)
211
+ - [GitHub](https://github.com/EmblemCompany/EmblemAi-AgentWallet)
@@ -0,0 +1,171 @@
1
+ # EmblemAI Command Reference
2
+
3
+ ## Slash Commands
4
+
5
+ All commands are prefixed with `/`. Type them in the input bar and press Enter.
6
+
7
+ ### General
8
+
9
+ | Command | Description |
10
+ |---------|-------------|
11
+ | `/help` | Show all available commands |
12
+ | `/settings` | Show current configuration (vault ID, model, streaming, debug, tools) |
13
+ | `/exit` | Exit the CLI (also: `/quit`) |
14
+
15
+ ### Chat and History
16
+
17
+ | Command | Description |
18
+ |---------|-------------|
19
+ | `/reset` | Clear conversation history and start fresh |
20
+ | `/clear` | Alias for `/reset` |
21
+ | `/history on` | Enable history retention between messages |
22
+ | `/history off` | Disable history retention (stateless mode) |
23
+ | `/history` | Show history status and recent messages |
24
+
25
+ ### Streaming and Debug
26
+
27
+ | Command | Description |
28
+ |---------|-------------|
29
+ | `/stream on` | Enable streaming mode (tokens appear as generated) |
30
+ | `/stream off` | Disable streaming mode (wait for full response) |
31
+ | `/stream` | Show current streaming status |
32
+ | `/debug on` | Enable debug mode (shows tool args, intent context) |
33
+ | `/debug off` | Disable debug mode |
34
+ | `/debug` | Show current debug status |
35
+
36
+ ### Model Selection
37
+
38
+ | Command | Description |
39
+ |---------|-------------|
40
+ | `/model <id>` | Set the active model by ID |
41
+ | `/model clear` | Reset to API default model |
42
+ | `/model` | Show currently selected model |
43
+
44
+ ### Tool Management
45
+
46
+ | Command | Description |
47
+ |---------|-------------|
48
+ | `/tools` | List all tools with selection status |
49
+ | `/tools add <id>` | Add a tool to the active set |
50
+ | `/tools remove <id>` | Remove a tool from the active set |
51
+ | `/tools clear` | Clear tool selection (enable auto-tools mode) |
52
+
53
+ When no tools are selected, the AI operates in **auto-tools mode**, dynamically choosing appropriate tools based on conversation context.
54
+
55
+ ### Authentication
56
+
57
+ | Command | Description |
58
+ |---------|-------------|
59
+ | `/auth` | Open authentication menu |
60
+ | `/wallet` | Show wallet addresses (EVM, Solana, BTC, Hedera) |
61
+ | `/portfolio` | Show portfolio (routes as a chat query) |
62
+
63
+ The `/auth` menu provides:
64
+
65
+ | Option | Description |
66
+ |--------|-------------|
67
+ | 1. Get API Key | Fetch your vault API key |
68
+ | 2. Get Vault Info | Show vault ID, addresses, creation date |
69
+ | 3. Session Info | Show current session details (identifier, expiry, auth type) |
70
+ | 4. Refresh Session | Refresh the auth session token |
71
+ | 5. EVM Address | Show your Ethereum/EVM address |
72
+ | 6. Solana Address | Show your Solana address |
73
+ | 7. BTC Addresses | Show your Bitcoin addresses (P2PKH, P2WPKH, P2TR) |
74
+ | 8. Backup Agent Auth | Export credentials to a backup file |
75
+ | 9. Logout | Clear session and exit (requires re-authentication on next run) |
76
+
77
+ ### Payment (PAYG Billing)
78
+
79
+ | Command | Description |
80
+ |---------|-------------|
81
+ | `/payment` | Show PAYG billing status (enabled, mode, debt, tokens) |
82
+ | `/payment enable` | Enable pay-as-you-go billing |
83
+ | `/payment disable` | Disable pay-as-you-go billing |
84
+ | `/payment token <TOKEN>` | Set payment token (SOL, ETH, HUSTLE, etc.) |
85
+ | `/payment mode <MODE>` | Set payment mode: `pay_per_request` or `debt_accumulation` |
86
+
87
+ ### Plugin Management
88
+
89
+ | Command | Description |
90
+ |---------|-------------|
91
+ | `/plugins` | List all plugins with enabled/disabled status |
92
+ | `/plugin <name> on` | Enable a plugin by name |
93
+ | `/plugin <name> off` | Disable a plugin by name |
94
+
95
+ ### Secrets
96
+
97
+ | Command | Description |
98
+ |---------|-------------|
99
+ | `/secrets` | Manage encrypted plugin secrets (interactive menu) |
100
+
101
+ Secrets are encrypted with your vault key and stored in `~/.emblemai/secrets.json`. Plugins are hot-reloaded after setting a secret (no restart needed).
102
+
103
+ ### Markdown Rendering
104
+
105
+ | Command | Description |
106
+ |---------|-------------|
107
+ | `/glow on` | Enable markdown rendering via glow |
108
+ | `/glow off` | Disable markdown rendering |
109
+ | `/glow` | Show glow status and version |
110
+
111
+ Requires [glow](https://github.com/charmbracelet/glow) to be installed.
112
+
113
+ ### Logging
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `/log on` | Enable stream logging to file |
118
+ | `/log off` | Disable stream logging |
119
+ | `/log` | Show logging status and file path |
120
+
121
+ Log file defaults to `~/.emblemai-stream.log`. Override with `--log-file <path>`.
122
+
123
+ ## Keyboard Shortcuts
124
+
125
+ ### Simple Mode (Default)
126
+
127
+ | Key | Action |
128
+ |-----|--------|
129
+ | `Enter` | Send message |
130
+ | `Up` | Recall previous input |
131
+ | `Ctrl+C` | Exit |
132
+ | `Ctrl+D` | Exit (EOF) |
133
+
134
+ ### TUI Mode
135
+
136
+ | Key | Action |
137
+ |-----|--------|
138
+ | `Tab` / `Shift+Tab` | Cycle focus between panels |
139
+ | `Enter` | Send message |
140
+ | `Ctrl+C` | Exit |
141
+ | `Up/Down` | Scroll panel content |
142
+ | Mouse scroll | Scroll in focused panel |
143
+
144
+ ## Command Examples
145
+
146
+ ### Session management
147
+
148
+ ```
149
+ /settings
150
+ /auth
151
+ /wallet
152
+ /payment
153
+ /reset
154
+ ```
155
+
156
+ ### Tool and model management
157
+
158
+ ```
159
+ /tools
160
+ /model gpt-4
161
+ /stream off
162
+ /debug on
163
+ ```
164
+
165
+ ### Plugin management
166
+
167
+ ```
168
+ /plugins
169
+ /plugin hustle-elizaos on
170
+ /plugin hustle-elizaos off
171
+ ```
@@ -0,0 +1,106 @@
1
+ # EmblemAI Plugin Reference
2
+
3
+ EmblemAI uses a plugin system to extend AI capabilities with client-side tools. Plugins are loaded at startup and register tools that the AI can call during conversations.
4
+
5
+ ---
6
+
7
+ ## Active Plugin
8
+
9
+ ### ElizaOS -- AI Agent Framework
10
+
11
+ **Package**: `@agenthustle/plugin-masq`
12
+ **Status**: Loaded by default
13
+ **Description**: Connects Hustle to the ElizaOS agent framework. Provides MASQ mode (HTTP server on port 3001) and inverse discovery to discover and register ElizaOS actions as client tools.
14
+
15
+ #### Configuration
16
+
17
+ The plugin is auto-configured at startup with:
18
+
19
+ - **MASQ**: Enabled on port 3001 -- exposes Hustle as an ElizaOS-compatible HTTP agent
20
+ - **Inverse discovery**: Enabled -- discovers actions from a running ElizaOS instance and registers them as client tools
21
+ - **Hustle client**: Wired automatically for inverse control (ElizaOS actions route through `hustleClient.chat()`)
22
+
23
+ #### Environment Variables
24
+
25
+ | Variable | Description | Default |
26
+ |----------|-------------|---------|
27
+ | `ELIZA_URL` | ElizaOS agent URL for inverse discovery | `http://localhost:3000` |
28
+ | `ELIZA_API_URL` | ElizaOS API URL (via `--eliza-url` flag) | -- |
29
+
30
+ ---
31
+
32
+ ## Available Plugins (Not Loaded)
33
+
34
+ The following plugins exist as packages but are currently disabled in the plugin loader. They can be re-enabled in `src/plugins/loader.js` by uncommenting their specs.
35
+
36
+ | Plugin | Package | Description |
37
+ |--------|---------|-------------|
38
+ | A2A | `@agenthustle/plugin-a2a` | Google Agent-to-Agent protocol v0.3.0 (discovery, messaging, tasks) |
39
+ | ACP | `@agenthustle/plugin-acp` | Virtuals Agent Commerce Protocol (marketplace, jobs, autonomous mode) |
40
+ | Bridge | `@agenthustle/plugin-bridge` | Cross-protocol message router (A2A, ACP, ElizaOS) |
41
+
42
+ ---
43
+
44
+ ## Plugin Management
45
+
46
+ ### Commands
47
+
48
+ ```
49
+ /plugins # List all plugins and their status
50
+ /plugin <name> on # Enable a plugin
51
+ /plugin <name> off # Disable a plugin
52
+ ```
53
+
54
+ ### Tool Selection
55
+
56
+ ```
57
+ /tools # List all available tools
58
+ /tools add <id> # Add a tool to the active set
59
+ /tools remove <id> # Remove a tool from the active set
60
+ /tools clear # Clear selection (enable auto-tools mode)
61
+ ```
62
+
63
+ When no tools are explicitly selected, the AI uses **auto-tools mode**, dynamically selecting appropriate tools based on conversation context.
64
+
65
+ ---
66
+
67
+ ## Plugin Architecture
68
+
69
+ ### Plugin Interface
70
+
71
+ Plugins follow the `HustlePlugin` interface:
72
+
73
+ ```js
74
+ {
75
+ name: 'plugin-name',
76
+ version: '1.0.0',
77
+ tools: [
78
+ {
79
+ name: 'tool_name',
80
+ description: 'What the tool does',
81
+ parameters: { type: 'object', properties: { ... } },
82
+ },
83
+ ],
84
+ executors: {
85
+ tool_name: async (args) => { /* implementation */ },
86
+ },
87
+ }
88
+ ```
89
+
90
+ ### Loading
91
+
92
+ Plugins are loaded in `src/plugins/loader.js` via `PluginManager.loadAll()`. Each plugin spec declares:
93
+
94
+ - `mod` -- npm package name
95
+ - `factory` -- exported factory function name
96
+ - `configKey` -- key in the config object for per-plugin settings
97
+
98
+ Missing packages are silently skipped.
99
+
100
+ ### Secrets
101
+
102
+ Plugins can declare secrets (e.g., API keys) that are encrypted with the user's vault key and stored in `~/.emblemai/secrets.json`. Secrets are lazily decrypted on first tool use. Use `/secrets` to manage them interactively.
103
+
104
+ ### Custom Plugins
105
+
106
+ User-created plugins are stored in `~/.emblemai-plugins.json` and loaded at startup. Custom plugins use serialized executor code that is compiled at load time.