@emblemvault/agentwallet 1.3.0 → 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/docs/SETUP.md ADDED
@@ -0,0 +1,180 @@
1
+ # EmblemAI Setup Guide
2
+
3
+ ## Prerequisites
4
+
5
+ - **Node.js** >= 18.0.0
6
+ - **Terminal** with 256-color support (iTerm2, Kitty, Windows Terminal, or any xterm-compatible terminal)
7
+ - **Optional**: [glow](https://github.com/charmbracelet/glow) for rich markdown rendering (`brew install glow` on macOS)
8
+
9
+ ## Installation
10
+
11
+ ### From npm
12
+
13
+ ```bash
14
+ npm install -g @emblemvault/agentwallet
15
+ ```
16
+
17
+ ### From source
18
+
19
+ ```bash
20
+ git clone https://github.com/EmblemCompany/EmblemAi-AgentWallet-Plugins.git
21
+ cd EmblemAi-AgentWallet-Plugins/cli
22
+ npm install
23
+ npm link # makes `emblemai` available globally
24
+ ```
25
+
26
+ ## Authentication
27
+
28
+ EmblemAI v3 supports two authentication modes: **browser auth** for interactive use and **password auth** for agent/scripted use.
29
+
30
+ ### Browser Auth (Interactive Mode)
31
+
32
+ When you run `emblemai` without `-p`, the CLI:
33
+
34
+ 1. Checks `~/.emblemai/session.json` for a saved session
35
+ 2. If a valid (non-expired) session exists, restores it instantly -- no login needed
36
+ 3. If no session, starts a local server on `127.0.0.1:18247` and opens your browser
37
+ 4. You authenticate via the EmblemVault auth modal in the browser
38
+ 5. The session JWT is captured, saved to disk, and the CLI proceeds
39
+ 6. If the browser can't open, the URL is printed for manual copy-paste
40
+ 7. If authentication times out (5 minutes), falls back to a password prompt
41
+
42
+ ### Password Auth (Agent Mode and `-p` flag)
43
+
44
+ **Login and signup are the same action** -- the first use of a password creates a vault, and subsequent uses of the same password return the same vault.
45
+
46
+ #### Password requirements
47
+
48
+ - Minimum 16 characters
49
+ - No recovery if lost (treat it like a private key)
50
+ - Different passwords produce completely different wallets and identities
51
+
52
+ #### Password resolution (priority order)
53
+
54
+ | Method | How to use | Priority |
55
+ |--------|-----------|----------|
56
+ | CLI argument | `emblemai -p "your-password-16-chars-min"` | 1 (highest, stored encrypted) |
57
+ | Environment variable | `export EMBLEM_PASSWORD="your-password"` | 2 (not stored) |
58
+ | Encrypted credential | dotenvx-encrypted `~/.emblemai/.env` | 3 |
59
+ | Auto-generate (agent mode) | Automatic on first run | 4 |
60
+ | Interactive prompt | Fallback when browser auth fails | 5 (lowest) |
61
+
62
+ In agent mode, if no password is found from sources 1-3, a secure random password is auto-generated and stored encrypted. This means agent mode works out of the box with no manual password setup.
63
+
64
+ ### What happens on authentication
65
+
66
+ 1. Browser auth: session JWT is received from browser and hydrated into the SDK
67
+ Password auth: password is sent to `EmblemAuthSDK.authenticatePassword()`
68
+ 2. A deterministic vault is derived -- same credentials always yield the same vault
69
+ 3. The session provides wallet addresses across multiple chains: Solana, Ethereum, Base, BSC, Polygon, Hedera, Bitcoin
70
+ 4. `HustleIncognitoClient` is initialized with the session
71
+ 5. Plugins are loaded and registered with the client
72
+
73
+ ## Running Modes
74
+
75
+ ### Interactive Mode (Default)
76
+
77
+ Readline-based interactive mode with streaming, glow rendering, and slash commands.
78
+
79
+ ```bash
80
+ emblemai # Browser auth (recommended)
81
+ emblemai -p "your-password" # Password auth (skips browser)
82
+ ```
83
+
84
+ ### Agent Mode
85
+
86
+ Single-shot queries for scripts and AI agent integrations. Sends one message, prints the response, and exits. Always uses password auth.
87
+
88
+ ```bash
89
+ emblemai --agent -p "your-password" -m "What are my wallet addresses?"
90
+ emblemai -a -p "your-password" -m "Show all my balances"
91
+ ```
92
+
93
+ ### Reset Conversation
94
+
95
+ ```bash
96
+ emblemai --reset
97
+ ```
98
+
99
+ ## Auth Backup and Restore
100
+
101
+ ### Backup
102
+
103
+ From the `/auth` menu (option 8), select **Backup Agent Auth** to export your credentials to a JSON file. This file contains your EmblemVault password -- keep it secure.
104
+
105
+ ### Restore
106
+
107
+ ```bash
108
+ emblemai --restore-auth ~/emblemai-auth-backup.json
109
+ ```
110
+
111
+ This places the credential files in `~/.emblemai/` so you can authenticate immediately.
112
+
113
+ ## Command-Line Flags
114
+
115
+ | Flag | Alias | Description |
116
+ |------|-------|-------------|
117
+ | `--password <pw>` | `-p` | Authentication password (16+ chars) -- skips browser auth |
118
+ | `--message <msg>` | `-m` | Message for agent mode |
119
+ | `--agent` | `-a` | Run in agent mode (single-shot, password auth only) |
120
+ | `--restore-auth <path>` | | Restore credentials from backup file and exit |
121
+ | `--reset` | | Clear conversation history and exit |
122
+ | `--debug` | | Start with debug mode enabled |
123
+ | `--stream` | | Start with streaming enabled (default: on) |
124
+ | `--log` | | Enable stream logging |
125
+ | `--log-file <path>` | | Override log file path (default: `~/.emblemai-stream.log`) |
126
+ | `--hustle-url <url>` | | Override Hustle API URL |
127
+ | `--auth-url <url>` | | Override auth service URL |
128
+ | `--api-url <url>` | | Override API service URL |
129
+
130
+ ## Environment Variables
131
+
132
+ | Variable | Description |
133
+ |----------|-------------|
134
+ | `EMBLEM_PASSWORD` | Authentication password |
135
+ | `HUSTLE_API_URL` | Override Hustle API endpoint |
136
+ | `EMBLEM_AUTH_URL` | Override auth service endpoint |
137
+ | `EMBLEM_API_URL` | Override API service endpoint |
138
+ | `ELIZA_URL` | ElizaOS agent URL for inverse discovery (default: `http://localhost:3000`) |
139
+ | `ELIZA_API_URL` | Override ElizaOS API URL |
140
+
141
+ CLI arguments override environment variables when both are provided.
142
+
143
+ ## First Run
144
+
145
+ 1. Install: `npm install -g @emblemvault/agentwallet`
146
+ 2. Run: `emblemai`
147
+ 3. Authenticate in the browser (or enter a password if prompted)
148
+ 4. Check `/plugins` to see which plugins loaded
149
+ 5. Type `/help` to see all commands
150
+ 6. Try: "What are my wallet addresses?" to verify authentication
151
+
152
+ ## File Locations
153
+
154
+ | File | Purpose |
155
+ |------|---------|
156
+ | `~/.emblemai/.env` | dotenvx-encrypted credentials (EMBLEM_PASSWORD) |
157
+ | `~/.emblemai/.env.keys` | dotenvx private decryption key (chmod 600) |
158
+ | `~/.emblemai/secrets.json` | auth-sdk encrypted plugin secrets |
159
+ | `~/.emblemai/session.json` | Saved browser auth session (auto-managed) |
160
+ | `~/.emblemai/history/{vaultId}.json` | Conversation history (per vault) |
161
+ | `~/.emblemai-stream.log` | Stream log (when enabled) |
162
+ | `~/.emblemai-plugins.json` | Custom plugin definitions |
163
+
164
+ Legacy credentials (`~/.emblem-vault`) are automatically migrated to the new dotenvx-encrypted format on first run. The old file is backed up to `~/.emblem-vault.bak`.
165
+
166
+ ## Supported Chains
167
+
168
+ Solana, Ethereum, Base, BSC, Polygon, Hedera, Bitcoin
169
+
170
+ ## Troubleshooting
171
+
172
+ | Issue | Solution |
173
+ |-------|----------|
174
+ | "Password must be at least 16 characters" | Use a longer password |
175
+ | "Authentication failed" | Check network connectivity to auth service |
176
+ | Browser doesn't open for auth | Copy the printed URL and open it manually |
177
+ | Session expired | Run `emblemai` again -- it will open the browser for a fresh login |
178
+ | glow not rendering | Install glow: `brew install glow` (optional, falls back to plain text) |
179
+ | Plugin not loading | Check that the npm package is installed |
180
+ | MASQ not responding on :3001 | Check ElizaOS plugin loaded via `/plugins` |