@zeroxyz/cli 0.0.29 → 0.0.32
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 +2 -2
- package/dist/index.js +629 -127
- package/package.json +1 -1
- package/skills/zero/SKILL.md +126 -19
package/package.json
CHANGED
package/skills/zero/SKILL.md
CHANGED
|
@@ -53,7 +53,10 @@ ZERO_AGENT=claude-web zero search "translate hello world"
|
|
|
53
53
|
|
|
54
54
|
Both are per-invocation and stateless — there's no persistent config to go stale if you move between sandboxes. Resolution order: `--agent` flag > `ZERO_AGENT` env var > host-specific env signals (`CLAUDECODE`, `CURSOR_TRACE_ID`, `TERM_PROGRAM=vscode`) > `unknown`. Canonical names: `claude-code`, `cursor`, `vscode`, `claude-web`, `codex`, `opencode`. Any string is accepted.
|
|
55
55
|
|
|
56
|
-
**Step 3 — Fund wallet:**
|
|
56
|
+
**Step 3 — Fund wallet:**
|
|
57
|
+
|
|
58
|
+
- **Running inside an agent (you — Claude, Cursor, Codex, etc.):** always pass `--no-open`. Funding links are **one-time use**, so opening them in a headless agent environment burns the link before the user can use it. Run `zero wallet fund --no-open`, then hand the printed URL to the user and ask them to open it in their browser. For manual transfer instead: `zero wallet fund --manual`.
|
|
59
|
+
- **Human at a terminal:** `zero wallet fund` — opens a browser to add USDC (Base). For manual transfer: `zero wallet fund --manual`.
|
|
57
60
|
|
|
58
61
|
**Step 4 — Confirm readiness:** `zero wallet balance`
|
|
59
62
|
|
|
@@ -68,7 +71,7 @@ Provide:
|
|
|
68
71
|
|
|
69
72
|
- Wallet address from `zero wallet address`.
|
|
70
73
|
- Balance from `zero wallet balance`.
|
|
71
|
-
- If balance is 0,
|
|
74
|
+
- If balance is 0, run `zero wallet fund --no-open` and give the printed one-time URL to the user to open (or suggest `zero wallet fund --manual` for a direct deposit address).
|
|
72
75
|
- 2-3 starter prompts based on available capabilities:
|
|
73
76
|
|
|
74
77
|
```bash
|
|
@@ -85,49 +88,151 @@ Starter prompts should be user-facing tasks, not command templates:
|
|
|
85
88
|
|
|
86
89
|
```bash
|
|
87
90
|
zero search "<query>"
|
|
88
|
-
zero get <position>
|
|
89
|
-
zero fetch <url> [-d '<json>'] [-H "Key:Value"] [--max-pay <amount>]
|
|
91
|
+
zero get <position> [--formatted]
|
|
92
|
+
zero fetch <url> [-X <method>] [-d '<json>' | -d @file | --data-stdin] [-H "Key:Value"] [--max-pay <amount>] [--json [--raw-body]] [--capability <id>]
|
|
90
93
|
zero runs [--capability <slug>] [--unreviewed]
|
|
91
|
-
zero review <runId> --accuracy <1-5> --value <1-5> --reliability <1-5>
|
|
92
|
-
zero review --capability <slug> --success --accuracy <1-5> --value <1-5> --reliability <1-5>
|
|
94
|
+
zero review <runId> --accuracy <1-5> --value <1-5> --reliability <1-5> [--content "<notes>"]
|
|
95
|
+
zero review --capability <slug> --success --accuracy <1-5> --value <1-5> --reliability <1-5> [--content "<notes>"]
|
|
93
96
|
```
|
|
94
97
|
|
|
95
98
|
### Workflow
|
|
96
99
|
|
|
97
100
|
1. **Search** — `zero search "weather forecast"` finds matching capabilities. Results show name, cost, rating, and success rate.
|
|
98
|
-
2. **Inspect** — `zero get 1`
|
|
99
|
-
3. **Call** — `zero fetch <url>` makes the request. If the server returns 402, payment is handled automatically (x402 and MPP
|
|
100
|
-
4. **Review** — `zero review <runId>` submits a quality review. Run IDs are printed after a successful fetch.
|
|
101
|
-
5. **Retroactive review** — if you lost a runId, run `zero runs --unreviewed` (or `zero runs --capability <slug> --unreviewed`)
|
|
101
|
+
2. **Inspect** — `zero get 1 --formatted` prints a human summary **and a copy-pasteable `Try it:` command** wired to the capability's schema. Plain `zero get 1` returns full JSON (URL, method, `bodySchema`, examples, pricing) for `jq` pipelines. **If `bodySchema` is `null`**, the capability hasn't been schema-indexed yet — skip it and `zero get 2`, don't invent field names.
|
|
102
|
+
3. **Call** — `zero fetch <url>` makes the request. If the server returns 402, payment is handled automatically (x402 and MPP, including cross-chain bridging from Base to Tempo).
|
|
103
|
+
4. **Review** — `zero review <runId>` submits a quality review. Run IDs are printed to **stderr** after a successful fetch (or returned on stdout in `--json` mode). Always review after a paid call, and **pass `--content "<notes>"` whenever you have something specific to say** — the content line lands on the capability's public detail page on zero.xyz, so it's what the next human buyer (and the next agent) reads when deciding whether to call this capability. See "Writing review content" below.
|
|
104
|
+
5. **Retroactive review** — if you lost a runId, run `zero runs --unreviewed` (or `zero runs --capability <slug> --unreviewed`). `zero review --capability <slug> ...` auto-resolves to your most recent un-reviewed run for that capability.
|
|
105
|
+
|
|
106
|
+
### Writing review content
|
|
107
|
+
|
|
108
|
+
`--content` is free-form and optional, but strongly encouraged. It's what appears on the capability's public page — so it's doing double duty as a signal for the next agent *and* as human-readable copy for buyers browsing zero.xyz.
|
|
109
|
+
|
|
110
|
+
**What makes a useful review:** concrete detail a reader can act on. Good examples from real reviews:
|
|
111
|
+
|
|
112
|
+
- *"Generated the requested gremlin-on-couch image faithfully in ~140ms. Schema straightforward, output URL loaded cleanly, zero surprises. At $0.003 the price-to-quality ratio is excellent."*
|
|
113
|
+
- *"Call worked on second attempt. Key learnings: set `wait_for_greeting=false` and use `first_sentence` to lead with your message, otherwise the AI hangs up on voicemail greetings."*
|
|
114
|
+
- *"Returned relevant market-report links quickly, but not a synthesized ranked answer. Better as raw web-search input than finished research."*
|
|
115
|
+
|
|
116
|
+
Each names the task attempted, what the output actually was, and a specific observation (latency, a gotcha, a fit/misfit note). That's the kind of line a human buyer trusts and another agent can learn from.
|
|
117
|
+
|
|
118
|
+
**Review failures with content too.** Failure notes are arguably more valuable — they warn the next caller. Example: *"FLUX Schnell returned HTTP 500 Internal Server Error — paid 0.003 USDC via MPP but got no image."* Pair with `--no-success`.
|
|
119
|
+
|
|
120
|
+
**Skip `--content` rather than write filler.** "Worked great", "Fast response", or test strings like "trial 1" add noise, pollute the capability's public page, and dilute the signal agents rely on. If you don't have a specific observation, just submit the numeric ratings.
|
|
121
|
+
|
|
122
|
+
**Fastest path:** `zero search "..." → zero get <n> --formatted → copy the `Try it:` line → edit placeholders → run it`. The `Try it` block already knows whether to use querystring vs `-d`, and labels every header as `[caller-provided]` so you know which `-H` flags to fill in yourself.
|
|
123
|
+
|
|
124
|
+
### Request Shape Cheatsheet
|
|
102
125
|
|
|
103
|
-
|
|
126
|
+
Read `bodySchema` from `zero get <n>` first. The schema describes an `input` envelope with `type: "http"`, a `method`, and either `queryParams` (GET) or `body` (POST). Translate the envelope into a real HTTP call — do **not** send the envelope as the request body.
|
|
127
|
+
|
|
128
|
+
**GET capabilities — put `queryParams` in the URL, not a body:**
|
|
104
129
|
|
|
105
130
|
```bash
|
|
106
|
-
# GET
|
|
107
|
-
zero fetch https://api.example.com/
|
|
131
|
+
# bodySchema declares: input.method = "GET", input.queryParams = { ip }
|
|
132
|
+
zero fetch "https://api.example.com/ip-geo/locate?ip=8.8.8.8"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**POST capabilities — send `input.body` as JSON:**
|
|
108
136
|
|
|
109
|
-
|
|
137
|
+
```bash
|
|
138
|
+
# bodySchema declares: input.method = "POST", input.body = { text, to }
|
|
110
139
|
zero fetch https://api.example.com/translate \
|
|
111
140
|
-d '{"text":"hello","to":"es"}' \
|
|
112
141
|
-H "Content-Type:application/json"
|
|
142
|
+
```
|
|
113
143
|
|
|
114
|
-
|
|
144
|
+
**Cap spend:**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
115
147
|
zero fetch https://api.example.com/expensive --max-pay 0.50
|
|
116
148
|
```
|
|
117
149
|
|
|
150
|
+
### Flag Reference (`zero fetch`)
|
|
151
|
+
|
|
152
|
+
| Flag | When to use |
|
|
153
|
+
|---|---|
|
|
154
|
+
| `-X, --method <verb>` | Force HTTP method. Defaults to `POST` when `-d` is set, otherwise `GET`. |
|
|
155
|
+
| `-d, --data <body>` | Request body. Three shapes: a literal JSON string (`-d '{"k":"v"}'`), a file reference (`-d @./payload.json`), or stdin (`-d @-`). Implies POST and auto-sets `Content-Type: application/json` if you didn't pass `-H`. |
|
|
156
|
+
| `--data-stdin` | Alias for `-d @-`. Read the request body from stdin. Mutually exclusive with `-d`. |
|
|
157
|
+
| `-H, --header <k:v>` | Add a header. Repeatable. Use for caller-provided auth/API keys the capability requires. |
|
|
158
|
+
| `--json` | Emit `{runId, ok, status, latencyMs, payment, body, bodyRaw}` as JSON on stdout. `body` is **parsed** when the response is JSON (opt out with `--raw-body`); `bodyRaw` is always the exact text. `ok` is `true` iff `status` is 2xx. |
|
|
159
|
+
| `--raw-body` | With `--json`: keep `body` as the raw response string instead of parsing JSON. |
|
|
160
|
+
| `--max-pay <usdc>` | Refuse to pay more than this per call. |
|
|
161
|
+
| `--capability <uid\|slug>` | Bind this fetch to a capability when you didn't just `zero search` — required to record a reviewable run in batch contexts. |
|
|
162
|
+
|
|
163
|
+
**Body size cap:** `-d` (inline, file, or stdin) rejects bodies over 10 MB with a clear error. For truly large payloads, split, compress, or contact the capability owner.
|
|
164
|
+
|
|
165
|
+
### Output Handling
|
|
166
|
+
|
|
167
|
+
`zero fetch` separates streams so piping works:
|
|
168
|
+
|
|
169
|
+
- **stdout** — response body only (text) or raw bytes (binary). In `--json` mode, a single JSON envelope instead.
|
|
170
|
+
- **stderr** — progress logs, payment info, the `Run ID: ...` line, review tips, warnings.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Default mode — body is clean on stdout
|
|
174
|
+
zero fetch "https://api.example.com/ip-geo/locate?ip=8.8.8.8" | jq .country
|
|
175
|
+
|
|
176
|
+
# --json mode — body is already parsed (ok flag + structured body)
|
|
177
|
+
zero fetch --json "https://api.example.com/ip-geo/locate?ip=8.8.8.8" \
|
|
178
|
+
| jq 'select(.ok) | {runId, country: .body.country}'
|
|
179
|
+
|
|
180
|
+
# Opt out of parsing if you need the literal bytes
|
|
181
|
+
zero fetch --json --raw-body "<url>" | jq '.bodyRaw'
|
|
182
|
+
|
|
183
|
+
# Suppress progress entirely
|
|
184
|
+
zero fetch "<url>" 2>/dev/null | jq .
|
|
185
|
+
|
|
186
|
+
# Binary (image/audio/pdf): redirect stdout to a file
|
|
187
|
+
zero fetch "<image-url>" > out.png
|
|
188
|
+
|
|
189
|
+
# Large payloads: use a file or stdin to avoid arg-size limits
|
|
190
|
+
zero fetch https://upload.example.com -d @./big-image.b64
|
|
191
|
+
cat payload.json | zero fetch https://api.example.com --data-stdin
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**`--json` envelope fields:**
|
|
195
|
+
|
|
196
|
+
| Field | Type | Notes |
|
|
197
|
+
|---|---|---|
|
|
198
|
+
| `runId` | `string\|null` | Zero-side run ID for `zero review`. `null` when the run wasn't recorded (missing wallet or capability). |
|
|
199
|
+
| `ok` | `boolean` | `true` iff `status` is in the 200–299 range. Use this, not `status`, for success checks. |
|
|
200
|
+
| `status` | `number\|null` | Upstream HTTP status code. |
|
|
201
|
+
| `latencyMs` | `number` | End-to-end call latency. |
|
|
202
|
+
| `payment` | `object\|null` | `{protocol, chain, txHash, amount, asset}` when a payment was made; `null` for free calls. |
|
|
203
|
+
| `body` | `any` | Parsed JSON for `application/json` responses, or the string for other text, or base64 string for binary. Pass `--raw-body` to always keep it as the raw string. |
|
|
204
|
+
| `bodyRaw` | `string\|null` | The response as text (or base64 when binary). Always present for forwarding / hashing. |
|
|
205
|
+
| `bodyEncoding` | `"base64"` | Only set when the response was binary. |
|
|
206
|
+
| `error` | `string` | Only set when the fetch or session-close failed. |
|
|
207
|
+
|
|
208
|
+
**When to reach for `--json`:** batch/agent pipelines where you need `runId`, `ok`, or `payment` programmatically. Default text mode is fine for human-directed one-offs.
|
|
209
|
+
|
|
210
|
+
**Reviewing programmatically:** capture `runId` from the envelope, then call `zero review <runId> --success --accuracy N --value N --reliability N` (use `--no-success` if `ok` was `false`).
|
|
211
|
+
|
|
118
212
|
### Response Handling
|
|
119
213
|
|
|
120
214
|
- Return the response payload to the user directly.
|
|
121
|
-
- If response contains a file URL, download it
|
|
215
|
+
- If response contains a file URL, download it: `curl -fsSL "<url>" -o <filename>`.
|
|
122
216
|
- After multi-request workflows, check remaining balance with `zero wallet balance`.
|
|
123
217
|
|
|
218
|
+
### Gotchas
|
|
219
|
+
|
|
220
|
+
- **Don't POST a GET envelope.** If `bodySchema` says `method: "GET"` with `queryParams`, encode those as URL query string. POSTing `{"input":{"queryParams":{...}}}` to a GET endpoint will 4xx.
|
|
221
|
+
- **Don't guess field names when `bodySchema` is `null`.** Skip to the next search result. The POST example above (`{text, to}`) is illustrative — real request bodies must match whatever the capability's own `bodySchema` declares (e.g. `{text, target_language}`), not the example's field names.
|
|
222
|
+
- **Large bodies go through `-d @file` or `--data-stdin`.** Inline `-d '<long-string>'` can run past shell arg limits (~1 MB) and fail silently. Anything bigger than a few KB is safer through a file or stdin.
|
|
223
|
+
- **`--json`'s `body` is already parsed for JSON responses.** No more `fromjson`/`JSON.parse` on the body field. If you want the literal bytes (e.g. to hash or forward), use `bodyRaw` or pass `--raw-body`.
|
|
224
|
+
- **Check `ok`, not `status`, for success.** `ok` is a pre-computed 2xx boolean; `status` is the raw HTTP code (useful for distinguishing 404 from 500 but not a success flag).
|
|
225
|
+
- **`--max-pay` is your cost guard.** Always set it before calling an unfamiliar capability or one with per-call pricing you haven't verified.
|
|
226
|
+
- **Capability must be resolvable.** If you skip `zero search` and call `zero fetch <url>` directly, pass `--capability <uid|slug>` so the run is recorded for review.
|
|
227
|
+
- **Review failures too, when they're the capability's fault.** A 4xx/5xx from the upstream API counts as a real result — submit `zero review <runId> --no-success --content "<what broke>"` so future agents see the failure and the specific symptom. Do **not** review failures caused by CLI-internal bugs (see Common Issues).
|
|
228
|
+
|
|
124
229
|
### Rules
|
|
125
230
|
|
|
126
231
|
- **Always `zero search` fresh, every time.** Never reuse a capability URL, slug, schema, or price from an earlier turn, prior conversation, training data, or memory. Capabilities churn constantly — endpoints go offline, prices change, schemas evolve, and rankings shift as reviews accumulate. A capability that worked yesterday may be dead, repriced, or outranked today. Searching again costs nothing and is the only way to get current trust scores and availability.
|
|
127
232
|
- **Always `zero get` before `zero fetch`.** Even if you "know" the URL, re-fetch the full details to confirm the URL, method, required headers, body schema, and current price. Do not reconstruct a fetch call from memory.
|
|
128
233
|
- Never guess endpoint URLs or schemas.
|
|
129
234
|
- Use `--max-pay` before potentially expensive requests.
|
|
130
|
-
- Review capabilities after every paid call
|
|
235
|
+
- Review capabilities after every paid call, and include `--content` with a concrete observation whenever you have one. Numeric ratings feed search ranking; the content line is what humans read on the capability's public page and what other agents quote when deciding whether to call it. Skip `--content` rather than write generic filler.
|
|
131
236
|
- Before ending a multi-call task, run `zero runs --unreviewed` and review anything you missed.
|
|
132
237
|
|
|
133
238
|
## Configuration
|
|
@@ -201,7 +306,8 @@ zero fetch https://nlp-api.example.com/sentiment \
|
|
|
201
306
|
-H "Content-Type:application/json"
|
|
202
307
|
|
|
203
308
|
# 4. Review the result (run ID is printed after fetch)
|
|
204
|
-
zero review abc123 --accuracy 5 --value 4 --reliability 5
|
|
309
|
+
zero review abc123 --accuracy 5 --value 4 --reliability 5 \
|
|
310
|
+
--content "Classified a 200-char product-review snippet as positive in ~180ms; confidence 0.94, matched my manual read. Schema clean, no auth needed."
|
|
205
311
|
|
|
206
312
|
# 5. Check remaining balance
|
|
207
313
|
zero wallet balance
|
|
@@ -213,11 +319,12 @@ zero wallet balance
|
|
|
213
319
|
|---|---|---|
|
|
214
320
|
| `zero: command not found` | CLI not installed | Run `npm i -g @zeroxyz/cli`, then retry. |
|
|
215
321
|
| "No wallet configured" | Wallet not initialized | Run `zero init` to generate a wallet, or `zero wallet set <key>` to import one. |
|
|
216
|
-
| Balance is 0 or insufficient funds | Wallet needs USDC |
|
|
322
|
+
| Balance is 0 or insufficient funds | Wallet needs USDC | From an agent: `zero wallet fund --no-open` and hand the one-time URL to the user. From a human terminal: `zero wallet fund` or `zero wallet fund --manual` for the deposit address. |
|
|
217
323
|
| Payment failed on fetch | Insufficient balance for the capability price | Check `zero wallet balance`, fund if needed, and use `--max-pay` to control spend. |
|
|
218
324
|
| No search results | Query too narrow | Broaden search terms: `zero search "<broader query>"`. |
|
|
219
325
|
| Wrong request schema (4xx error) | Incorrect body or headers | Run `zero get <position>` to check the exact schema, method, and required headers. |
|
|
220
326
|
| Cross-chain bridge delay | Bridging USDC from Base to Tempo | Automatic — the CLI bridges with a 25% buffer. Wait for confirmation and retry if needed. |
|
|
327
|
+
| `No client registered for x402 version: N` | CLI-internal payment bug — not a capability problem | Skip to the next search result. Optionally `zero bug-report "x402 version N unsupported on <slug>"`. Do not `zero review --no-success` (not the capability's fault). |
|
|
221
328
|
|
|
222
329
|
## Try These
|
|
223
330
|
|