nirium-cli 2.0.0 → 2.0.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 +40 -26
- package/bin/nirium.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# nirium-cli
|
|
2
2
|
|
|
3
|
-
Scaffold Stellar agent projects
|
|
3
|
+
Scaffold Stellar agent projects, including one that charges for itself.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install -g nirium-cli
|
|
@@ -37,14 +37,15 @@ The generated server is about ten lines, because `x402Serve()` from the
|
|
|
37
37
|
[`nirium`](https://www.npmjs.com/package/nirium) SDK carries the facilitator
|
|
38
38
|
client, the scheme registration and the route shape.
|
|
39
39
|
|
|
40
|
-
**Usage telemetry (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
**Usage telemetry (off by default):** `x402Serve()` sends Nirium nothing
|
|
41
|
+
unless you turn it on. If you set `NIRIUM_X402SERVE_TELEMETRY=true` in the
|
|
42
|
+
generated `.env`, it sends a small usage ping when the server starts and
|
|
43
|
+
again every 50 requests or 10 minutes: your `STELLAR_PAY_TO` address, the
|
|
44
|
+
network, the number of routes or requests, the SDK version, and a short hash
|
|
45
|
+
of your `X402_FACILITATOR_API_KEY` (the first 16 characters of its SHA-256,
|
|
46
|
+
never the key itself). The ping never blocks, delays or fails a charge, and
|
|
47
|
+
it does not authorize or gate anything. Leave the variable unset and nothing
|
|
48
|
+
is sent. (Checked against the code of `nirium` 0.16.0.)
|
|
48
49
|
|
|
49
50
|
## Listen to protocol signals
|
|
50
51
|
|
|
@@ -64,15 +65,18 @@ NIRIUM_SECRET_KEY=S... nirium pay https://your-api.example.com/premium/signals
|
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
Signs and settles a real x402 payment against any endpoint that returns a
|
|
67
|
-
402, then prints the response. No scaffolding involved
|
|
68
|
+
402, then prints the response. No scaffolding involved. This hits a live
|
|
68
69
|
server directly, useful for testing a `nirium serve` instance or someone
|
|
69
70
|
else's paid API without writing a client.
|
|
70
71
|
|
|
71
72
|
There is no `--secret` flag: a key passed as a command-line argument sits
|
|
72
73
|
in your shell history and in `ps`'s full command line for anyone else on
|
|
73
|
-
the machine to read.
|
|
74
|
-
|
|
75
|
-
without
|
|
74
|
+
the machine to read. There are three safe ways to give
|
|
75
|
+
it the key: set `NIRIUM_SECRET_KEY`; run `nirium config set secretKey` with
|
|
76
|
+
no value (a terminal asks for the key without showing it, or you can pipe
|
|
77
|
+
it in through stdin) to save it once; or leave it unset and a terminal
|
|
78
|
+
prompts for it each time. `nirium config set secretKey S...` with the key
|
|
79
|
+
on the command line is refused and nothing is saved.
|
|
76
80
|
|
|
77
81
|
| Option | Purpose |
|
|
78
82
|
|---|---|
|
|
@@ -80,7 +84,7 @@ without echoing what you type.
|
|
|
80
84
|
| `-a, --amount <amount>` | Override the price the server advertises |
|
|
81
85
|
| `--json` | Machine-readable result: status, duration, payer, tx hash, response body |
|
|
82
86
|
|
|
83
|
-
The secret key never leaves your machine except as a signature
|
|
87
|
+
The secret key never leaves your machine except as a signature: the CLI
|
|
84
88
|
signs locally and sends the signed payment, not the key itself. Missing a
|
|
85
89
|
secret key fails immediately with the three ways to supply one, before any
|
|
86
90
|
network call happens.
|
|
@@ -114,10 +118,19 @@ can also come from `nirium config set payTo`.
|
|
|
114
118
|
## Check an agent
|
|
115
119
|
|
|
116
120
|
```bash
|
|
117
|
-
nirium status
|
|
121
|
+
nirium status --url https://nirium-agent.fly.dev
|
|
118
122
|
```
|
|
119
123
|
|
|
120
|
-
|
|
124
|
+
Calls the `/health` endpoint of an agent and prints whether it is running
|
|
125
|
+
and for how long. It also prints a version and a network line, but they only
|
|
126
|
+
carry a value when the agent reports one: the Nirium testnet agent's
|
|
127
|
+
`/health` returns just `status`, `service` and `uptime` today, so those two
|
|
128
|
+
lines show `undefined`. `--url` points to the agent you want to check; `https://nirium-agent.fly.dev` is the Nirium testnet agent.
|
|
129
|
+
Without `--url` it looks for an agent on your own machine at
|
|
130
|
+
`http://localhost:3001`, so it reports "unreachable" if you are not running
|
|
131
|
+
one.
|
|
132
|
+
|
|
133
|
+
## Diagnose your x402 setup
|
|
121
134
|
|
|
122
135
|
```bash
|
|
123
136
|
nirium doctor --network testnet
|
|
@@ -125,11 +138,12 @@ nirium doctor --network testnet
|
|
|
125
138
|
|
|
126
139
|
Five checks against your actual environment before you find out the hard
|
|
127
140
|
way in production: `payTo` is a well-formed public key (not a secret key
|
|
128
|
-
pasted in the wrong field
|
|
141
|
+
pasted in the wrong field, a real mistake this catches), the facilitator
|
|
129
142
|
API key authenticates against `channels.openzeppelin.com`, the Soroban RPC
|
|
130
143
|
endpoint for your target network is reachable, `STELLAR_SECRET_KEY` (if
|
|
131
144
|
set) is validly formatted, and MPP config (if set) is internally
|
|
132
|
-
consistent.
|
|
145
|
+
consistent. The MPP check only validates the values in your config; Nirium
|
|
146
|
+
does not charge MPP payments on mainnet today. Reads from `.env` in the current directory by default.
|
|
133
147
|
|
|
134
148
|
| Option | Purpose |
|
|
135
149
|
|---|---|
|
|
@@ -175,17 +189,17 @@ nirium verify <cid>
|
|
|
175
189
|
```
|
|
176
190
|
|
|
177
191
|
Independently re-checks a Nirium audit document anchored to IPFS: fetches
|
|
178
|
-
it from a gateway, recomputes its SHA-256 content hash, and
|
|
179
|
-
document carries an agent attestation
|
|
192
|
+
it from a gateway, recomputes its SHA-256 content hash, and, if the
|
|
193
|
+
document carries an agent attestation, verifies the ed25519 signature
|
|
180
194
|
over `nirium-audit-v1:<content_sha256>` against the declared signer's
|
|
181
195
|
Stellar public key. Nothing here trusts the document's own claims about
|
|
182
196
|
itself; both the hash and the signed statement are recomputed from the
|
|
183
197
|
raw content, not read off the document.
|
|
184
198
|
|
|
185
|
-
| Option | Purpose |
|
|
186
|
-
|
|
199
|
+
| Option | Purpose | Default |
|
|
200
|
+
|---|---|---|
|
|
187
201
|
| `-g, --gateway <url>` | IPFS gateway to fetch from | `https://gateway.pinata.cloud` |
|
|
188
|
-
| `--json` | machine-readable result |
|
|
202
|
+
| `--json` | machine-readable result | off |
|
|
189
203
|
|
|
190
204
|
Exits non-zero (and prints which check failed) if the hash doesn't match
|
|
191
205
|
or the signature doesn't verify.
|
|
@@ -202,7 +216,7 @@ nirium config delete facilitatorApiKey
|
|
|
202
216
|
|
|
203
217
|
Stores `secretKey`, `payTo`, `network`, and `facilitatorApiKey` in
|
|
204
218
|
`~/.niriumrc.json` (mode `600`) so `pay`, `serve`, and `doctor` don't need
|
|
205
|
-
them repeated on every invocation
|
|
219
|
+
them repeated on every invocation. Command-line flags and environment
|
|
206
220
|
variables still take priority when present. `list` and `get` mask secret
|
|
207
221
|
values in their output; the raw file is never printed.
|
|
208
222
|
|
|
@@ -211,7 +225,7 @@ values in their output; the raw file is never printed.
|
|
|
211
225
|
| Option | Values | Default |
|
|
212
226
|
|---|---|---|
|
|
213
227
|
| `-n, --name <name>` | project directory name | `nirium-bot-v1` |
|
|
214
|
-
| `-t, --template <template>` | `ts` or `py`
|
|
228
|
+
| `-t, --template <template>` | `ts` or `py` (`bot` only) | `ts` |
|
|
215
229
|
|
|
216
230
|
## Links
|
|
217
231
|
|
|
@@ -221,4 +235,4 @@ values in their output; the raw file is never printed.
|
|
|
221
235
|
|
|
222
236
|
## License
|
|
223
237
|
|
|
224
|
-
Apache 2.0
|
|
238
|
+
Apache 2.0, Nirium Protocol
|
package/bin/nirium.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// ═══════════════════════════════════════════════════════════════
|
|
4
|
-
// Nirium — Autonomous Agent CLI (v2.0.
|
|
4
|
+
// Nirium — Autonomous Agent CLI (v2.0.1)
|
|
5
5
|
// ═══════════════════════════════════════════════════════════════
|
|
6
6
|
//
|
|
7
7
|
// Everything below is one flat file on purpose, not a build artifact:
|
|
@@ -40,7 +40,7 @@ const program = new Command();
|
|
|
40
40
|
program
|
|
41
41
|
.name('nirium')
|
|
42
42
|
.description('Nirium protocol development tool')
|
|
43
|
-
.version('2.0.
|
|
43
|
+
.version('2.0.1');
|
|
44
44
|
|
|
45
45
|
// --- COMMAND: create bot ---
|
|
46
46
|
program
|
|
@@ -134,7 +134,7 @@ program
|
|
|
134
134
|
// --- COMMAND: doctor ---
|
|
135
135
|
program
|
|
136
136
|
.command('doctor')
|
|
137
|
-
.description('CLI preflight diagnostics for x402
|
|
137
|
+
.description('CLI preflight diagnostics for x402 misconfiguration (the MPP check only validates config), or a remote seller with --seller')
|
|
138
138
|
.option('-n, --network <network>', 'Stellar network: testnet or pubnet', 'testnet')
|
|
139
139
|
.option('-c, --config <path>', 'Path to environment or config file')
|
|
140
140
|
.option('--seller <url>', 'Validate a remote x402 seller at this URL without paying')
|
|
@@ -1372,7 +1372,7 @@ function formatDoctorOutput(report) {
|
|
|
1372
1372
|
const lines = [];
|
|
1373
1373
|
lines.push(report.seller
|
|
1374
1374
|
? `🩺 Nirium Doctor — remote x402 seller`
|
|
1375
|
-
: `🩺 Nirium Doctor — x402
|
|
1375
|
+
: `🩺 Nirium Doctor — x402 Diagnostic Report`);
|
|
1376
1376
|
if (report.seller) lines.push(`Seller: ${report.seller}`);
|
|
1377
1377
|
lines.push(`Target Network: ${report.network || 'n/a'}`);
|
|
1378
1378
|
lines.push(`Timestamp: ${report.timestamp}`);
|