agstell-cli 0.1.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 +234 -0
- package/bin/agentmarket.js +2 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +761 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +412 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# AgentMarket CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for interacting with the AgentMarket API marketplace using x402 micropayments on Stellar.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g agentmarket-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx agentmarket-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Initialize with your Stellar wallet
|
|
21
|
+
agentmarket init
|
|
22
|
+
|
|
23
|
+
# Or generate a new testnet keypair
|
|
24
|
+
agentmarket init --generate
|
|
25
|
+
|
|
26
|
+
# Fund your testnet account
|
|
27
|
+
agentmarket fund
|
|
28
|
+
|
|
29
|
+
# Check your balance
|
|
30
|
+
agentmarket balance
|
|
31
|
+
|
|
32
|
+
# List available APIs
|
|
33
|
+
agentmarket list
|
|
34
|
+
|
|
35
|
+
# Call an API (auto-pays with USDC)
|
|
36
|
+
agentmarket call weather --city "San Francisco"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Commands
|
|
40
|
+
|
|
41
|
+
### `init`
|
|
42
|
+
|
|
43
|
+
Initialize the CLI with your Stellar wallet.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Interactive mode
|
|
47
|
+
agentmarket init
|
|
48
|
+
|
|
49
|
+
# With secret key
|
|
50
|
+
agentmarket init --key SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
51
|
+
|
|
52
|
+
# Generate new keypair
|
|
53
|
+
agentmarket init --generate
|
|
54
|
+
|
|
55
|
+
# Use mainnet (default is testnet)
|
|
56
|
+
agentmarket init --network mainnet
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `fund`
|
|
60
|
+
|
|
61
|
+
Fund your testnet account using Stellar Friendbot (testnet only).
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
agentmarket fund
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `balance`
|
|
68
|
+
|
|
69
|
+
Check your wallet balance.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
agentmarket balance
|
|
73
|
+
# or
|
|
74
|
+
agentmarket bal
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Output:
|
|
78
|
+
```
|
|
79
|
+
Balance retrieved
|
|
80
|
+
|
|
81
|
+
Network: testnet
|
|
82
|
+
Address: GXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
83
|
+
XLM: 10000.0000000 XLM
|
|
84
|
+
USDC: 100.0000000 USDC
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### `list`
|
|
88
|
+
|
|
89
|
+
List available APIs.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# List all APIs
|
|
93
|
+
agentmarket list
|
|
94
|
+
|
|
95
|
+
# Filter by category
|
|
96
|
+
agentmarket list --category Data
|
|
97
|
+
agentmarket list -c AI
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Categories: Data, Finance, Geo, AI
|
|
101
|
+
|
|
102
|
+
### `call`
|
|
103
|
+
|
|
104
|
+
Call an API with automatic x402 payment.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Weather
|
|
108
|
+
agentmarket call weather --city "Tokyo"
|
|
109
|
+
|
|
110
|
+
# Air Quality
|
|
111
|
+
agentmarket call air-quality --city "Delhi"
|
|
112
|
+
|
|
113
|
+
# News
|
|
114
|
+
agentmarket call news --topic "cryptocurrency"
|
|
115
|
+
|
|
116
|
+
# Currency conversion
|
|
117
|
+
agentmarket call currency --from USD --to EUR --amount 100
|
|
118
|
+
|
|
119
|
+
# Geolocation
|
|
120
|
+
agentmarket call geolocation --ip "8.8.8.8"
|
|
121
|
+
|
|
122
|
+
# AI inference
|
|
123
|
+
agentmarket call ai --prompt "Explain blockchain in simple terms"
|
|
124
|
+
|
|
125
|
+
# Custom params (JSON)
|
|
126
|
+
agentmarket call weather -p '{"city": "London", "units": "metric"}'
|
|
127
|
+
|
|
128
|
+
# Dry run (no payment)
|
|
129
|
+
agentmarket call weather --city "Paris" --dry-run
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### `info`
|
|
133
|
+
|
|
134
|
+
Get detailed information about an API.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
agentmarket info weather
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### `history`
|
|
141
|
+
|
|
142
|
+
View your call history.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Last 20 calls
|
|
146
|
+
agentmarket history
|
|
147
|
+
|
|
148
|
+
# Last 50 calls
|
|
149
|
+
agentmarket history --limit 50
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `config`
|
|
153
|
+
|
|
154
|
+
View or update configuration.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Show config
|
|
158
|
+
agentmarket config --show
|
|
159
|
+
|
|
160
|
+
# Update settings
|
|
161
|
+
agentmarket config --network mainnet
|
|
162
|
+
agentmarket config --budget 50
|
|
163
|
+
agentmarket config --marketplace https://api.agentmarket.xyz
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## How It Works
|
|
167
|
+
|
|
168
|
+
1. **Request**: When you call an API, the CLI first sends a request
|
|
169
|
+
2. **402 Response**: The server responds with HTTP 402 and payment details
|
|
170
|
+
3. **Payment**: CLI automatically sends USDC via Stellar
|
|
171
|
+
4. **Data**: CLI retries the request with payment proof and returns data
|
|
172
|
+
|
|
173
|
+
All of this happens automatically - you just make the call!
|
|
174
|
+
|
|
175
|
+
## Configuration
|
|
176
|
+
|
|
177
|
+
Config is stored in `~/.agentmarket/config.json`:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"stellarNetwork": "testnet",
|
|
182
|
+
"secretKey": "SXXXXX...",
|
|
183
|
+
"publicKey": "GXXXXX...",
|
|
184
|
+
"marketplaceUrl": "https://agentmarket.xyz",
|
|
185
|
+
"budgetLimit": 10
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Call history is stored in `~/.agentmarket/history.json`.
|
|
190
|
+
|
|
191
|
+
## Pricing
|
|
192
|
+
|
|
193
|
+
| API | Price per call |
|
|
194
|
+
|-----|---------------|
|
|
195
|
+
| Weather | $0.001 USDC |
|
|
196
|
+
| Air Quality | $0.001 USDC |
|
|
197
|
+
| News | $0.002 USDC |
|
|
198
|
+
| Currency | $0.001 USDC |
|
|
199
|
+
| Geolocation | $0.001 USDC |
|
|
200
|
+
| AI Inference | $0.005 USDC |
|
|
201
|
+
|
|
202
|
+
## Environment Variables
|
|
203
|
+
|
|
204
|
+
You can also configure via environment variables:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
export AGENTMARKET_SECRET_KEY=SXXXXX...
|
|
208
|
+
export AGENTMARKET_NETWORK=testnet
|
|
209
|
+
export AGENTMARKET_URL=https://agentmarket.xyz
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Clone
|
|
216
|
+
git clone https://github.com/agentmarket/cli.git
|
|
217
|
+
cd cli
|
|
218
|
+
|
|
219
|
+
# Install deps
|
|
220
|
+
npm install
|
|
221
|
+
|
|
222
|
+
# Build
|
|
223
|
+
npm run build
|
|
224
|
+
|
|
225
|
+
# Run locally
|
|
226
|
+
node dist/cli.js
|
|
227
|
+
|
|
228
|
+
# Development mode (watch)
|
|
229
|
+
npm run dev
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|