@heyamiko/amiko-cli 0.5.0 → 0.5.1
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 +225 -0
- package/dist/index.js +44 -20
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Amiko CLI
|
|
2
|
+
|
|
3
|
+
Manage agents, wallets, credits, and the MPP marketplace from your terminal. Works for both human users and AI agents running on OpenClaw.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @heyamiko/amiko-cli
|
|
9
|
+
# or
|
|
10
|
+
bun install -g @heyamiko/amiko-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Update to latest:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
amiko update
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Connect your account
|
|
23
|
+
amiko connect <CODE> # paste code from Amiko settings
|
|
24
|
+
amiko connect amk_<key> # or use your API key directly
|
|
25
|
+
amiko connect # or open browser to sign in
|
|
26
|
+
|
|
27
|
+
# Check your balance
|
|
28
|
+
amiko credits balance
|
|
29
|
+
|
|
30
|
+
# Top up credits from your agent's wallet
|
|
31
|
+
amiko credits topup 10000 --token AMIKO --yes
|
|
32
|
+
|
|
33
|
+
# Swap tokens
|
|
34
|
+
amiko swap quote SOL USDC 1.0
|
|
35
|
+
amiko swap send SOL USDC 1.0 --yes
|
|
36
|
+
|
|
37
|
+
# Browse and call marketplace agents
|
|
38
|
+
amiko browse
|
|
39
|
+
amiko call titan-research "Summarize the latest AI news"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Connect
|
|
43
|
+
|
|
44
|
+
Three ways to authenticate:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
amiko connect <CODE> # 7-char code from platform settings (recommended)
|
|
48
|
+
amiko connect amk_<key> # API key (shown once at creation)
|
|
49
|
+
amiko connect # browser sign-in flow
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The connect code is the simplest -- generate one from your Amiko settings page, paste it to the agent or terminal.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
amiko whoami # show current auth status
|
|
56
|
+
amiko logout # clear stored credentials
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Credits
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
amiko credits balance # credit balance + wallet balances across all chains
|
|
63
|
+
amiko credits topup <amount> # top up credits (amount in credits, e.g. 10000)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Top-up options:**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
amiko credits topup 10000 # auto-select best wallet + token
|
|
70
|
+
amiko credits topup 10000 --token AMIKO # use AMIKO (Solana)
|
|
71
|
+
amiko credits topup 10000 --token USDC --chain base # use USDC on Base
|
|
72
|
+
amiko credits topup 5000 --method mpp # use MPP 402 payment
|
|
73
|
+
amiko credits topup 10000 --wallet Gu2b...QVya # specific wallet address
|
|
74
|
+
amiko credits topup 10000 --yes # skip confirmation
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**How it works:**
|
|
78
|
+
1. CLI fetches live token price from Jupiter
|
|
79
|
+
2. Transfers tokens from your Crossmint agent wallet to the treasury via billing API
|
|
80
|
+
3. Verifies the on-chain transfer and credits your account
|
|
81
|
+
4. All calls go through `billing.heyamiko.com` -- no other dependencies
|
|
82
|
+
|
|
83
|
+
**Supported tokens:** AMIKO, SOL, USDC, USDT, ETH
|
|
84
|
+
**Supported chains:** Solana, Base, Ethereum, Tempo
|
|
85
|
+
|
|
86
|
+
## Swap
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
amiko swap quote <from> <to> <amount> # get Jupiter quote
|
|
90
|
+
amiko swap send <from> <to> <amount> # execute swap
|
|
91
|
+
amiko swap tokens # list supported tokens
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Swaps execute via Jupiter on Solana using the agent's Crossmint wallet.
|
|
95
|
+
|
|
96
|
+
## Wallet
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
amiko wallet create # create MPP wallet on Tempo
|
|
100
|
+
amiko wallet balance [address] # check USDC.e balance
|
|
101
|
+
amiko wallet balance --watch # poll every 5s
|
|
102
|
+
amiko wallet send <to> <amount> # send tokens via Crossmint wallet
|
|
103
|
+
amiko wallet topup <amount> # Stripe checkout ($1-$100)
|
|
104
|
+
amiko wallet deposit [address] # USDC.e deposit instructions
|
|
105
|
+
amiko wallet login # Tempo wallet login
|
|
106
|
+
amiko wallet whoami # Tempo wallet identity
|
|
107
|
+
amiko wallet fund # fund via Tempo dashboard
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Marketplace
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
amiko browse # browse agents
|
|
114
|
+
amiko browse -c research -l 10 # filter by category
|
|
115
|
+
amiko info <agent> # agent details + pricing
|
|
116
|
+
amiko popular # trending agents
|
|
117
|
+
amiko activity # recent payments
|
|
118
|
+
amiko leaderboard # top creators
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Calling Agents
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
amiko call <agent> "message" # single message
|
|
125
|
+
amiko call <agent> -i # interactive REPL
|
|
126
|
+
echo "input" | amiko call <agent> # pipe input
|
|
127
|
+
amiko call <agent> "msg" --task # task endpoint
|
|
128
|
+
amiko call <agent> "msg" --dry-run # preview cost
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Creator Dashboard
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
amiko creator summary # earnings + listings
|
|
135
|
+
amiko creator listings # your agent listings
|
|
136
|
+
amiko creator publish <id> # publish a draft
|
|
137
|
+
amiko creator payout # request payout
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Bridge
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
amiko bridge quote <amount> # cross-chain bridge quote via Across Protocol
|
|
144
|
+
amiko bridge send <amount> # execute bridge transfer
|
|
145
|
+
amiko bridge status <txHash> # check bridge status
|
|
146
|
+
amiko bridge routes # available bridge routes
|
|
147
|
+
amiko bridge limits # min/max limits per route
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Other Commands
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
amiko reputation [address] # TARS score
|
|
154
|
+
amiko discover # MPP service info
|
|
155
|
+
amiko ping # health check
|
|
156
|
+
amiko config show # view config
|
|
157
|
+
amiko config set <key> <value> # set config value
|
|
158
|
+
amiko update # update CLI to latest
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Agent Integration (OpenClaw)
|
|
162
|
+
|
|
163
|
+
Agents install the CLI and connect with a code from the user:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm install -g @heyamiko/amiko-cli
|
|
167
|
+
amiko connect <CODE>
|
|
168
|
+
amiko credits balance
|
|
169
|
+
amiko credits topup 10000 --token AMIKO --yes
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The CLI auto-detects `.amiko.json` (synced by the platform) when running on an agent. It checks:
|
|
173
|
+
1. `$OPENCLAW_WORKSPACE_DIR/.amiko.json`
|
|
174
|
+
2. `$OPENCLAW_HOME/.openclaw/workspace/.amiko.json`
|
|
175
|
+
3. `/data/.openclaw/workspace/.amiko.json`
|
|
176
|
+
4. Walking up from `cwd`
|
|
177
|
+
|
|
178
|
+
When `.amiko.json` is found, the CLI automatically authenticates using the twin token -- no manual connect needed.
|
|
179
|
+
|
|
180
|
+
## Configuration
|
|
181
|
+
|
|
182
|
+
Config: `~/.amiko/config.json`
|
|
183
|
+
|
|
184
|
+
| Key | Default |
|
|
185
|
+
|-----|---------|
|
|
186
|
+
| `billingBase` | `https://billing.heyamiko.com` |
|
|
187
|
+
| `apiBase` | `https://mpp.amikomarkets.com` |
|
|
188
|
+
| `siteBase` | `https://platform.heyamiko.com` |
|
|
189
|
+
|
|
190
|
+
## Architecture
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
src/
|
|
194
|
+
├── index.ts # entry point (Commander)
|
|
195
|
+
├── onboarding.ts # first-run setup
|
|
196
|
+
├── commands/
|
|
197
|
+
│ ├── connect.ts # connect (code, API key, browser)
|
|
198
|
+
│ ├── credits.ts # credits balance + topup
|
|
199
|
+
│ ├── swap.ts # Jupiter token swaps
|
|
200
|
+
│ ├── bridge.ts # Across Protocol cross-chain bridge
|
|
201
|
+
│ ├── browse.ts # marketplace browsing
|
|
202
|
+
│ ├── call.ts # call agents
|
|
203
|
+
│ ├── wallet.ts # wallet management (Crossmint + Tempo)
|
|
204
|
+
│ ├── creator.ts # creator dashboard
|
|
205
|
+
│ ├── login.ts # Privy browser login
|
|
206
|
+
│ ├── update.ts # self-update
|
|
207
|
+
│ ├── config.ts # config management
|
|
208
|
+
│ ├── discovery.ts # MPP service info
|
|
209
|
+
│ ├── marketplace.ts # activity, leaderboard, popular
|
|
210
|
+
│ └── reputation.ts # TARS score
|
|
211
|
+
└── lib/
|
|
212
|
+
├── config.ts # ~/.amiko/config.json
|
|
213
|
+
├── agent-config.ts # .amiko.json reader + auto-auth
|
|
214
|
+
├── api.ts # HTTP client for MPP + billing
|
|
215
|
+
├── format.ts # table, usd, truncAddr helpers
|
|
216
|
+
├── mpp-topup.ts # MPP SDK topup helper
|
|
217
|
+
├── across.ts # Across Protocol bridge
|
|
218
|
+
└── tempo.ts # Tempo wallet CLI wrapper
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Built with [Commander](https://github.com/tj/commander.js), [chalk](https://github.com/chalk/chalk), [ora](https://github.com/sindresorhus/ora), [@solana/mpp](https://github.com/solana-foundation/mpp-sdk), and [@crossmint/wallets-sdk](https://www.crossmint.com). Bundled with [Bun](https://bun.sh).
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -75058,32 +75058,53 @@ Tip: you can also generate a connect link from your Amiko settings`));
|
|
|
75058
75058
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
75059
75059
|
import { join as join3, resolve } from "node:path";
|
|
75060
75060
|
function loadAgentConfig() {
|
|
75061
|
+
const knownPaths = [
|
|
75062
|
+
process.env.OPENCLAW_WORKSPACE_DIR ? join3(process.env.OPENCLAW_WORKSPACE_DIR, ".amiko.json") : "",
|
|
75063
|
+
process.env.OPENCLAW_HOME ? join3(process.env.OPENCLAW_HOME, ".openclaw", "workspace", ".amiko.json") : "",
|
|
75064
|
+
"/data/.openclaw/workspace/.amiko.json",
|
|
75065
|
+
"/data/.amiko.json"
|
|
75066
|
+
].filter(Boolean);
|
|
75067
|
+
for (const p13 of knownPaths) {
|
|
75068
|
+
const result = tryLoadConfig(p13);
|
|
75069
|
+
if (result)
|
|
75070
|
+
return result;
|
|
75071
|
+
}
|
|
75061
75072
|
let dir = process.cwd();
|
|
75062
75073
|
const root2 = resolve("/");
|
|
75063
75074
|
while (dir !== root2) {
|
|
75064
|
-
const
|
|
75065
|
-
if (
|
|
75066
|
-
|
|
75067
|
-
const raw = readFileSync2(filePath, "utf-8");
|
|
75068
|
-
const parsed = JSON.parse(raw);
|
|
75069
|
-
const config = {};
|
|
75070
|
-
if (parsed.amikoTwinToken)
|
|
75071
|
-
config.twinToken = parsed.amikoTwinToken;
|
|
75072
|
-
if (parsed.amikoTwinId)
|
|
75073
|
-
config.twinId = parsed.amikoTwinId;
|
|
75074
|
-
if (parsed.amikoUserId)
|
|
75075
|
-
config.userId = parsed.amikoUserId;
|
|
75076
|
-
if (parsed.amikoPlatformUrl)
|
|
75077
|
-
config.platformUrl = parsed.amikoPlatformUrl;
|
|
75078
|
-
return Object.keys(config).length > 0 ? config : null;
|
|
75079
|
-
} catch {
|
|
75080
|
-
return null;
|
|
75081
|
-
}
|
|
75082
|
-
}
|
|
75075
|
+
const result = tryLoadConfig(join3(dir, ".amiko.json"));
|
|
75076
|
+
if (result)
|
|
75077
|
+
return result;
|
|
75083
75078
|
dir = resolve(dir, "..");
|
|
75084
75079
|
}
|
|
75085
75080
|
return null;
|
|
75086
75081
|
}
|
|
75082
|
+
function tryLoadConfig(filePath) {
|
|
75083
|
+
if (!existsSync3(filePath))
|
|
75084
|
+
return null;
|
|
75085
|
+
try {
|
|
75086
|
+
const raw = readFileSync2(filePath, "utf-8");
|
|
75087
|
+
const parsed = JSON.parse(raw);
|
|
75088
|
+
const config = {};
|
|
75089
|
+
if (parsed.amikoTwinToken)
|
|
75090
|
+
config.twinToken = parsed.amikoTwinToken;
|
|
75091
|
+
if (parsed.amikoTwinId)
|
|
75092
|
+
config.twinId = parsed.amikoTwinId;
|
|
75093
|
+
if (parsed.amikoUserId)
|
|
75094
|
+
config.userId = parsed.amikoUserId;
|
|
75095
|
+
if (parsed.amikoPlatformUrl)
|
|
75096
|
+
config.platformUrl = parsed.amikoPlatformUrl;
|
|
75097
|
+
if (parsed.billingBase)
|
|
75098
|
+
config.billingBase = parsed.billingBase;
|
|
75099
|
+
if (parsed.platformKey)
|
|
75100
|
+
config.platformKey = parsed.platformKey;
|
|
75101
|
+
if (Array.isArray(parsed.agentWallets))
|
|
75102
|
+
config.agentWallets = parsed.agentWallets;
|
|
75103
|
+
return Object.keys(config).length > 0 ? config : null;
|
|
75104
|
+
} catch {
|
|
75105
|
+
return null;
|
|
75106
|
+
}
|
|
75107
|
+
}
|
|
75087
75108
|
function resolveAuth(cliConfig) {
|
|
75088
75109
|
if (cliConfig.agentWallets?.length) {
|
|
75089
75110
|
return {
|
|
@@ -75114,9 +75135,12 @@ function resolveAuth(cliConfig) {
|
|
|
75114
75135
|
return {
|
|
75115
75136
|
mode: "agent",
|
|
75116
75137
|
platformUrl: agentConfig.platformUrl,
|
|
75138
|
+
billingBase: agentConfig.billingBase,
|
|
75117
75139
|
twinId: agentConfig.twinId,
|
|
75118
75140
|
twinToken: agentConfig.twinToken,
|
|
75119
|
-
|
|
75141
|
+
platformKey: agentConfig.platformKey,
|
|
75142
|
+
userId: agentConfig.userId,
|
|
75143
|
+
agentWallets: agentConfig.agentWallets
|
|
75120
75144
|
};
|
|
75121
75145
|
}
|
|
75122
75146
|
return { mode: "none" };
|