@itpay/cli 0.1.0 → 0.1.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 +41 -246
- package/bin/itp +24 -57
- package/docs/agent/buyer/cart-checkout.json +1 -1
- package/package.json +1 -4
- package/e2e-local.sh +0 -134
- package/skills/voltagent/SKILL.md +0 -603
- package/smoke.sh +0 -426
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ It does not contain the closed-source SaaS backend, database files, payment keys
|
|
|
15
15
|
|
|
16
16
|
## What This CLI Does
|
|
17
17
|
|
|
18
|
-
`itp` lets a developer or coding agent discover ItPay services, create cart-first checkouts, show QR payments, wait for verified payment, report secure human delivery status,
|
|
18
|
+
`itp` lets a developer or coding agent discover ItPay services, create cart-first checkouts, show QR payments, wait for verified payment, report secure human delivery status, create one-time human account portal links, and read human-approved Vault grants without exposing raw keys or protected content to the agent.
|
|
19
19
|
|
|
20
20
|
Main flow:
|
|
21
21
|
|
|
@@ -31,7 +31,7 @@ claude-code
|
|
|
31
31
|
openclaw
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Default
|
|
34
|
+
Default API endpoint:
|
|
35
35
|
|
|
36
36
|
```text
|
|
37
37
|
http://localhost:3000
|
|
@@ -42,7 +42,6 @@ Override it for ItPay staging or production:
|
|
|
42
42
|
```bash
|
|
43
43
|
export ITPAY_API_BASE=https://your-itpay-core.example.com
|
|
44
44
|
export ITPAY_CORE_BASE_URL=https://your-itpay-core.example.com
|
|
45
|
-
export VOLTAGENT_API_BASE=https://your-api.example.com
|
|
46
45
|
```
|
|
47
46
|
|
|
48
47
|
## Repository Layout
|
|
@@ -51,7 +50,6 @@ export VOLTAGENT_API_BASE=https://your-api.example.com
|
|
|
51
50
|
.
|
|
52
51
|
├── bin/itp # Node.js CLI entrypoint
|
|
53
52
|
├── skills/itpay-buyer/SKILL.md # Buyer agent quick-start skill
|
|
54
|
-
├── skills/voltagent/SKILL.md # Legacy VoltaGent compatibility skill
|
|
55
53
|
├── docs/agent/buyer/*.json # Agent-readable docs graph
|
|
56
54
|
├── install.sh # Unix user-level installer
|
|
57
55
|
├── install.ps1 # Windows PowerShell installer
|
|
@@ -85,7 +83,7 @@ Non-interactive agent hosts such as Codex automatically use file storage to
|
|
|
85
83
|
avoid OS keychain prompts. To force file storage anywhere:
|
|
86
84
|
|
|
87
85
|
```bash
|
|
88
|
-
ITP_CREDENTIAL_STORE=file itp
|
|
86
|
+
ITP_CREDENTIAL_STORE=file itp buyer auth status --json
|
|
89
87
|
```
|
|
90
88
|
|
|
91
89
|
If native credential storage is unavailable, the CLI falls back to:
|
|
@@ -108,10 +106,8 @@ The agent should give the returned `login_url` to the human and must not open or
|
|
|
108
106
|
|
|
109
107
|
## Install From npm
|
|
110
108
|
|
|
111
|
-
After publishing:
|
|
112
|
-
|
|
113
109
|
```bash
|
|
114
|
-
npm install -g
|
|
110
|
+
npm install -g @itpay/cli
|
|
115
111
|
```
|
|
116
112
|
|
|
117
113
|
Verify all command aliases:
|
|
@@ -125,7 +121,7 @@ itpay_cli --version
|
|
|
125
121
|
Run without installing globally:
|
|
126
122
|
|
|
127
123
|
```bash
|
|
128
|
-
npx
|
|
124
|
+
npx @itpay/cli --version
|
|
129
125
|
```
|
|
130
126
|
|
|
131
127
|
## Agent First Step
|
|
@@ -191,193 +187,56 @@ node ./bin/itp --version
|
|
|
191
187
|
Set API endpoint if not using local backend:
|
|
192
188
|
|
|
193
189
|
```bash
|
|
194
|
-
export
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
For the agent-native one-command flow, let the CLI authenticate, create the
|
|
198
|
-
checkout, wait for verified payment, and deliver the grant/API credential to
|
|
199
|
-
the local `itp` credential store:
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
itp setup --credits 100 --method alipay --json
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
This returns `status=grant_ready` with `base_url`, `openai_base_url`, and the
|
|
206
|
-
local token helper command. It does not write Codex, Claude Code, or OpenClaw
|
|
207
|
-
config by default.
|
|
208
|
-
|
|
209
|
-
Runtime config writing is opt-in:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
itp setup --credits 100 --target codex --method alipay --install-runtime --json
|
|
190
|
+
export ITPAY_API_BASE=https://your-itpay-core.example.com
|
|
213
191
|
```
|
|
214
192
|
|
|
215
|
-
|
|
216
|
-
the
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
QR display is automatic in terminals and machine-readable for chat agents:
|
|
193
|
+
For the current buyer commerce flow, search the catalog, create a cart/checkout,
|
|
194
|
+
show the human QR/payment entry, wait for verified payment, and report only
|
|
195
|
+
redacted secure delivery status:
|
|
220
196
|
|
|
221
197
|
```bash
|
|
222
|
-
itp
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
198
|
+
itp buyer catalog search --query 企业工商 --json
|
|
199
|
+
itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=阿里 --json
|
|
200
|
+
itp buyer checkout create --cart <cart_id> --email buyer@example.com --json
|
|
201
|
+
itp buyer payment wait <payment_intent_id> --json
|
|
202
|
+
itp buyer checkout status <checkout_id> --json
|
|
226
203
|
```
|
|
227
204
|
|
|
228
|
-
|
|
205
|
+
For the one-command buyer helper:
|
|
229
206
|
|
|
230
207
|
```bash
|
|
231
|
-
itp
|
|
232
|
-
itp resume --json
|
|
208
|
+
itp buy var_itpay_enterprise_fuzzy_search_cny01 --email buyer@example.com --input company_name=阿里 --json
|
|
233
209
|
```
|
|
234
210
|
|
|
235
|
-
|
|
236
|
-
`--method alipay`. Fake/mock/offline flows are developer-only simulation hooks
|
|
237
|
-
and are intentionally omitted from the normal user flow.
|
|
238
|
-
|
|
239
|
-
For the ItPay sandbox buyer flow, agents should use the public buyer commands:
|
|
211
|
+
For multi-item cart tests:
|
|
240
212
|
|
|
241
213
|
```bash
|
|
242
|
-
itp buyer catalog search --query "吃鸡 情侣皮肤" --json
|
|
243
|
-
itp buyer cart create --variant var_pubg_couple_skin_cny20 --json
|
|
244
214
|
itp buyer cart create --variants var_itpay_enterprise_precise_lookup_cny05,var_itpay_enterprise_fuzzy_search_cny01 --quantities 1,1 --json
|
|
245
215
|
itp buyer cart show <cart_id> --json
|
|
246
216
|
itp buyer cart add <cart_id> --variant var_itpay_enterprise_fuzzy_search_cny01 --quantity 1 --json
|
|
247
217
|
itp buyer cart remove <cart_id> --line <cart_line_item_id> --json
|
|
248
|
-
itp buyer checkout create --cart <cart_id> --email buyer@example.com --phone +8613800000000 --json
|
|
249
|
-
itp buy var_pubg_couple_skin_cny20 --sandbox --email buyer@example.com --phone +8613800000000 --no-wait --json
|
|
250
|
-
itp buyer payment wait <payment_intent_id> --json
|
|
251
|
-
itp buyer checkout status <checkout_id> --json
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Alipay sandbox responses expose a stable `payment_entry_url` for browser/status
|
|
255
|
-
fallback and a tokenized `qr_image_url` for the human scanner. Render or download
|
|
256
|
-
`qr_image_url`; do not turn `payment_entry_url` into a QR code. If the Alipay
|
|
257
|
-
sandbox app reports "order not found", ask the API for a fresh display QR:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --json
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
`wait.timeout` from `/events/wait` is one long-poll cycle timing out, not a
|
|
264
|
-
payment failure. The CLI heartbeat reports this as `still_waiting` and continues
|
|
265
|
-
until the overall command timeout or a verified payment event. Ops-only sandbox
|
|
266
|
-
commands such as `itp ops sandbox worker run-once --json` require the sandbox ops
|
|
267
|
-
token and are not part of normal buyer/agent authority.
|
|
268
|
-
|
|
269
|
-
Live checkpoint on 2026-06-08: `itp buy ... --no-wait --json` created an Alipay
|
|
270
|
-
sandbox payment intent, the human scanned the `qr_image_url` SVG directly with
|
|
271
|
-
the Alipay sandbox app, public notify reached `/v1/alipay/sandbox/notify`, and
|
|
272
|
-
`itp buyer payment wait` returned `payment_intent.verified` without query
|
|
273
|
-
recovery.
|
|
274
|
-
|
|
275
|
-
Manual flow starts with Alipay-bound agent authentication:
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
itp auth register --runtime codex --json
|
|
279
218
|
```
|
|
280
219
|
|
|
281
|
-
|
|
282
|
-
scan approval, stores the returned session, and then returns the saved account
|
|
283
|
-
metadata as JSON.
|
|
284
|
-
|
|
285
|
-
The response includes the actual saved `username`. Keep it if you plan to log in
|
|
286
|
-
later with a password.
|
|
287
|
-
|
|
288
|
-
Set the first Web login password:
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
printf 'your-password\n' | itp account set-password --password-stdin --json
|
|
292
|
-
```
|
|
220
|
+
Payment QR rules:
|
|
293
221
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
List available plans:
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
itp plans --json
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
Create a checkout:
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
itp checkout create --credits 100 --method alipay --json
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
Wait for verified payment and grant delivery:
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
itp payment wait <checkout_id> --timeout 120 --json
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
Install the grant credential:
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
itp grants install <grant_id> --target codex --json
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
Optionally install runtime config:
|
|
326
|
-
|
|
327
|
-
```bash
|
|
328
|
-
itp install codex --grant <grant_id> --json
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
For local no-network config writing:
|
|
332
|
-
|
|
333
|
-
```bash
|
|
334
|
-
itp install codex --grant <grant_id> --offline --no-test --json
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Check balance, usage, and orders:
|
|
338
|
-
|
|
339
|
-
```bash
|
|
340
|
-
itp balance --json
|
|
341
|
-
itp usage --grant <grant_id> --json
|
|
342
|
-
itp checkout list --limit 20 --json
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
Rotate or revoke a grant:
|
|
346
|
-
|
|
347
|
-
```bash
|
|
348
|
-
itp keys rotate --grant <grant_id> --json
|
|
349
|
-
itp grants revoke <grant_id> --json
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
## Runtime Notes
|
|
353
|
-
|
|
354
|
-
### Codex
|
|
355
|
-
|
|
356
|
-
The CLI writes:
|
|
357
|
-
|
|
358
|
-
```text
|
|
359
|
-
~/.codex/config.toml
|
|
360
|
-
~/.itp/voltagent.env
|
|
361
|
-
```
|
|
222
|
+
- Show `local_qr_path` first when the CLI provides it.
|
|
223
|
+
- Otherwise render the ItPay-hosted `qr_png_url` / `preferred_qr_url`.
|
|
224
|
+
- Use `mobile_wallet_url` only as a human mobile fallback.
|
|
225
|
+
- Do not generate your own QR from payment URLs.
|
|
226
|
+
- Treat only `payment_intent.verified` as payment success.
|
|
362
227
|
|
|
363
|
-
|
|
228
|
+
If the human wants the agent to analyze delivered content, the human must reveal
|
|
229
|
+
the artifact in the ItPay account portal with Passkey and choose "Give to
|
|
230
|
+
Agent". The agent then discovers the approved grant itself:
|
|
364
231
|
|
|
365
232
|
```bash
|
|
366
|
-
|
|
233
|
+
itp buyer vault grants list --checkout <checkout_id> --json
|
|
234
|
+
itp buyer vault grants read <agent_read_grant_id> --json
|
|
235
|
+
itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --json
|
|
367
236
|
```
|
|
368
237
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
The CLI writes the configured Anthropic-compatible base URL and credential through the target profile.
|
|
372
|
-
|
|
373
|
-
### OpenClaw
|
|
374
|
-
|
|
375
|
-
The CLI supports `openclaw` as an install target. Use:
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
itp grants install <grant_id> --target openclaw --json
|
|
379
|
-
itp install openclaw --grant <grant_id> --json
|
|
380
|
-
```
|
|
238
|
+
Agents must not ask humans to paste claim links, claim tokens, raw API results,
|
|
239
|
+
provider keys, or grant ids into chat.
|
|
381
240
|
|
|
382
241
|
## Agent Skill And Docs
|
|
383
242
|
|
|
@@ -395,15 +254,10 @@ Repository files:
|
|
|
395
254
|
|
|
396
255
|
```text
|
|
397
256
|
skills/itpay-buyer/SKILL.md
|
|
398
|
-
skills/voltagent/SKILL.md
|
|
399
257
|
docs/agent/buyer/*.json
|
|
400
258
|
```
|
|
401
259
|
|
|
402
|
-
Agents should use the buyer skill when the user asks to search, buy, pay, or receive an ItPay service.
|
|
403
|
-
|
|
404
|
-
```bash
|
|
405
|
-
itp skill show --role voltagent --json
|
|
406
|
-
```
|
|
260
|
+
Agents should use the buyer skill when the user asks to search, buy, pay, or receive an ItPay service.
|
|
407
261
|
|
|
408
262
|
The skill rules are strict:
|
|
409
263
|
|
|
@@ -416,10 +270,10 @@ The skill rules are strict:
|
|
|
416
270
|
|
|
417
271
|
## Local Backend E2E
|
|
418
272
|
|
|
419
|
-
When a local
|
|
273
|
+
When a local ItPay backend is running on `http://localhost:3000`:
|
|
420
274
|
|
|
421
275
|
```bash
|
|
422
|
-
|
|
276
|
+
ITPAY_API_BASE=http://localhost:3000 ./e2e-local.sh
|
|
423
277
|
```
|
|
424
278
|
|
|
425
279
|
The E2E script uses a temporary HOME, so it does not touch your real:
|
|
@@ -429,24 +283,7 @@ The E2E script uses a temporary HOME, so it does not touch your real:
|
|
|
429
283
|
~/.codex
|
|
430
284
|
```
|
|
431
285
|
|
|
432
|
-
The script covers
|
|
433
|
-
|
|
434
|
-
```text
|
|
435
|
-
server health
|
|
436
|
-
plans
|
|
437
|
-
auth register
|
|
438
|
-
account password setup
|
|
439
|
-
Alipay checkout
|
|
440
|
-
payment wait
|
|
441
|
-
grant install
|
|
442
|
-
codex offline install
|
|
443
|
-
balance
|
|
444
|
-
checkout list
|
|
445
|
-
usage
|
|
446
|
-
key rotation
|
|
447
|
-
token issue
|
|
448
|
-
grant revoke
|
|
449
|
-
```
|
|
286
|
+
The script covers the current buyer CLI smoke path and local backend contracts.
|
|
450
287
|
|
|
451
288
|
## Development Checks
|
|
452
289
|
|
|
@@ -467,7 +304,8 @@ e2e-local.sh
|
|
|
467
304
|
install.ps1
|
|
468
305
|
install.sh
|
|
469
306
|
package.json
|
|
470
|
-
skills/
|
|
307
|
+
skills/itpay-buyer/SKILL.md
|
|
308
|
+
docs/agent/buyer/*.json
|
|
471
309
|
smoke.sh
|
|
472
310
|
```
|
|
473
311
|
|
|
@@ -488,19 +326,13 @@ npm login
|
|
|
488
326
|
Check package name:
|
|
489
327
|
|
|
490
328
|
```bash
|
|
491
|
-
npm view
|
|
329
|
+
npm view @itpay/cli name
|
|
492
330
|
```
|
|
493
331
|
|
|
494
332
|
If the package is not published yet, npm returns a not-found error.
|
|
495
333
|
|
|
496
334
|
Publish:
|
|
497
335
|
|
|
498
|
-
```bash
|
|
499
|
-
npm publish
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
For a scoped package:
|
|
503
|
-
|
|
504
336
|
```bash
|
|
505
337
|
npm publish --access public
|
|
506
338
|
```
|
|
@@ -509,7 +341,7 @@ Post-publish install test:
|
|
|
509
341
|
|
|
510
342
|
```bash
|
|
511
343
|
TMP_PREFIX=$(mktemp -d)
|
|
512
|
-
npm install -g --prefix "$TMP_PREFIX"
|
|
344
|
+
npm install -g --prefix "$TMP_PREFIX" @itpay/cli
|
|
513
345
|
"$TMP_PREFIX/bin/itp" --version
|
|
514
346
|
"$TMP_PREFIX/bin/itp" skill show --role buyer --json
|
|
515
347
|
"$TMP_PREFIX/bin/itp" docs show quickstart --role buyer --json
|
|
@@ -517,41 +349,6 @@ npm install -g --prefix "$TMP_PREFIX" itpay_cli
|
|
|
517
349
|
"$TMP_PREFIX/bin/itpay_cli" --version
|
|
518
350
|
```
|
|
519
351
|
|
|
520
|
-
## Backend Contract
|
|
521
|
-
|
|
522
|
-
The CLI expects a VoltaGent-compatible backend that exposes:
|
|
523
|
-
|
|
524
|
-
```text
|
|
525
|
-
GET /api/status
|
|
526
|
-
GET /api/itp/plans
|
|
527
|
-
POST /api/itp/auth/register
|
|
528
|
-
POST /api/itp/auth/login
|
|
529
|
-
POST /api/itp/auth/device/start
|
|
530
|
-
POST /api/itp/auth/device/:auth_id/poll
|
|
531
|
-
GET /api/itp/auth/status
|
|
532
|
-
GET /api/itp/account
|
|
533
|
-
POST /api/itp/account/password
|
|
534
|
-
POST /api/itp/checkout
|
|
535
|
-
GET /api/itp/checkout/:id
|
|
536
|
-
POST /api/itp/payments/alipay/notify
|
|
537
|
-
GET /api/itp/orders
|
|
538
|
-
GET /api/itp/balance
|
|
539
|
-
GET /api/itp/usage
|
|
540
|
-
GET /api/itp/grants
|
|
541
|
-
POST /api/itp/grants/:id/install
|
|
542
|
-
POST /api/itp/grants/:id/install-ack
|
|
543
|
-
POST /api/itp/grants/:id/rotate
|
|
544
|
-
POST /api/itp/grants/:id/revoke
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
Relay base URLs returned by the backend:
|
|
548
|
-
|
|
549
|
-
```text
|
|
550
|
-
/openai/v1
|
|
551
|
-
/anthropic/v1
|
|
552
|
-
/gemini/v1beta
|
|
553
|
-
```
|
|
554
|
-
|
|
555
352
|
## Safety and Secrets
|
|
556
353
|
|
|
557
354
|
Never commit:
|
|
@@ -562,7 +359,7 @@ Never commit:
|
|
|
562
359
|
~/.itp
|
|
563
360
|
~/.codex
|
|
564
361
|
credentials.json
|
|
565
|
-
|
|
362
|
+
itpay.env
|
|
566
363
|
*.pem
|
|
567
364
|
*.key
|
|
568
365
|
*.p12
|
|
@@ -588,7 +385,7 @@ Typical update flow:
|
|
|
588
385
|
```bash
|
|
589
386
|
git pull
|
|
590
387
|
npm run check
|
|
591
|
-
# edit bin/itp, skills/itpay-buyer/SKILL.md, docs/agent/buyer/*.json
|
|
388
|
+
# edit bin/itp, skills/itpay-buyer/SKILL.md, or docs/agent/buyer/*.json
|
|
592
389
|
npm run check
|
|
593
390
|
npm pack --dry-run
|
|
594
391
|
git status --short
|
|
@@ -603,7 +400,6 @@ For behavior changes, update both:
|
|
|
603
400
|
bin/itp
|
|
604
401
|
docs/agent/buyer/*.json
|
|
605
402
|
skills/itpay-buyer/SKILL.md
|
|
606
|
-
skills/voltagent/SKILL.md
|
|
607
403
|
```
|
|
608
404
|
|
|
609
405
|
If the backend contract changes, update:
|
|
@@ -613,5 +409,4 @@ README.md
|
|
|
613
409
|
e2e-local.sh
|
|
614
410
|
docs/agent/buyer/*.json
|
|
615
411
|
skills/itpay-buyer/SKILL.md
|
|
616
|
-
skills/voltagent/SKILL.md
|
|
617
412
|
```
|
package/bin/itp
CHANGED
|
@@ -9,7 +9,7 @@ import { fileURLToPath } from "node:url";
|
|
|
9
9
|
import QRCode from "qrcode";
|
|
10
10
|
|
|
11
11
|
const VERSION = "0.1.2";
|
|
12
|
-
const DEFAULT_API_BASE = process.env.ITPAY_API_BASE || process.env.ITPAY_CORE_BASE_URL ||
|
|
12
|
+
const DEFAULT_API_BASE = process.env.ITPAY_API_BASE || process.env.ITPAY_CORE_BASE_URL || "http://localhost:3000";
|
|
13
13
|
const CONFIG_DIR = path.join(os.homedir(), ".itp");
|
|
14
14
|
const CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
|
|
15
15
|
const STATE_PATH = path.join(CONFIG_DIR, "state.json");
|
|
@@ -193,15 +193,6 @@ async function main() {
|
|
|
193
193
|
output({
|
|
194
194
|
version: VERSION,
|
|
195
195
|
commands: [
|
|
196
|
-
"auth register",
|
|
197
|
-
"auth register --host gemini --display chat --no-wait --json",
|
|
198
|
-
"auth login",
|
|
199
|
-
"auth device start",
|
|
200
|
-
"auth device poll <auth_id>",
|
|
201
|
-
"setup --credits 100 --method alipay",
|
|
202
|
-
"setup --plan credit-300 --method alipay",
|
|
203
|
-
"setup --plan credit-300 --method alipay --host gemini --display chat --json",
|
|
204
|
-
"setup --credits 100 --target codex --method alipay --install-runtime",
|
|
205
196
|
"buy var_pubg_couple_skin_cny20 --sandbox --email buyer@example.com --phone +8613800000000 --json",
|
|
206
197
|
"buy var_pubg_couple_skin_cny20 --sandbox --email buyer@example.com --phone +8613800000000 --no-wait --json",
|
|
207
198
|
"buyer catalog search --query 企业工商 --category business_data_api --provider itpay_enterprise_data --json",
|
|
@@ -236,30 +227,7 @@ async function main() {
|
|
|
236
227
|
"resume --json",
|
|
237
228
|
"resume --run-id <run_id> --host gemini --display none --json",
|
|
238
229
|
"runs list|current|show <run_id>|forget <run_id>",
|
|
239
|
-
"auth status",
|
|
240
|
-
"account show",
|
|
241
230
|
"account login-link",
|
|
242
|
-
"account set-password --password-stdin",
|
|
243
|
-
"plans list",
|
|
244
|
-
"plans show <plan>",
|
|
245
|
-
"checkout create --credits 100 --method alipay",
|
|
246
|
-
"checkout create --plan credit-300 --method alipay --idempotency-key <uuid>",
|
|
247
|
-
"checkout qr <checkout_id>",
|
|
248
|
-
"checkout open",
|
|
249
|
-
"checkout recover <checkout_id>",
|
|
250
|
-
"checkout list --limit 20",
|
|
251
|
-
"payment wait <checkout_id> --timeout 120",
|
|
252
|
-
"balance",
|
|
253
|
-
"usage --today --model <model>",
|
|
254
|
-
"grants list",
|
|
255
|
-
"grants show <grant_id>",
|
|
256
|
-
"grants install <grant_id> --target codex",
|
|
257
|
-
"grants revoke <grant_id>",
|
|
258
|
-
"keys list",
|
|
259
|
-
"keys rotate --grant <grant_id>",
|
|
260
|
-
"keys revoke --grant <grant_id>",
|
|
261
|
-
"token issue --grant <grant_id> --stdout",
|
|
262
|
-
"sync",
|
|
263
231
|
"skill show",
|
|
264
232
|
"skill show --role buyer --json",
|
|
265
233
|
"skill path --role buyer",
|
|
@@ -2456,20 +2424,20 @@ function installClaudeCode(grantId, credentials, dryRun) {
|
|
|
2456
2424
|
|
|
2457
2425
|
function installCodex(grantId, credentials, dryRun) {
|
|
2458
2426
|
const configPath = path.join(os.homedir(), ".codex", "config.toml");
|
|
2459
|
-
const envPath = path.join(CONFIG_DIR, "
|
|
2427
|
+
const envPath = path.join(CONFIG_DIR, "itpay.env");
|
|
2460
2428
|
const existing = readText(configPath, "");
|
|
2461
2429
|
const block = [
|
|
2462
|
-
'model_provider = "
|
|
2430
|
+
'model_provider = "itpay"',
|
|
2463
2431
|
'model = "openai-code-default"',
|
|
2464
2432
|
"",
|
|
2465
|
-
"[model_providers.
|
|
2466
|
-
'name = "
|
|
2433
|
+
"[model_providers.itpay]",
|
|
2434
|
+
'name = "ItPay"',
|
|
2467
2435
|
`base_url = "${escapeTomlString(credentials.openai_base_url)}"`,
|
|
2468
|
-
'env_key = "
|
|
2436
|
+
'env_key = "ITPAY_API_KEY"'
|
|
2469
2437
|
].join("\n");
|
|
2470
|
-
const nextConfig = replaceManagedBlock(existing, "
|
|
2438
|
+
const nextConfig = replaceManagedBlock(existing, "itpay", block);
|
|
2471
2439
|
const configWrite = writeTextWithBackup(configPath, nextConfig, 0o600, dryRun);
|
|
2472
|
-
const envWrite = writeTextWithBackup(envPath, `export
|
|
2440
|
+
const envWrite = writeTextWithBackup(envPath, `export ITPAY_API_KEY=${quoteShell(credentials.key)}\n`, 0o600, dryRun);
|
|
2473
2441
|
return {
|
|
2474
2442
|
target: "codex",
|
|
2475
2443
|
grant_id: grantId,
|
|
@@ -2479,7 +2447,7 @@ function installCodex(grantId, credentials, dryRun) {
|
|
|
2479
2447
|
{ path: envPath, action: envWrite.action, backup_path: envWrite.backup_path || null }
|
|
2480
2448
|
],
|
|
2481
2449
|
warnings: [
|
|
2482
|
-
"Codex reads
|
|
2450
|
+
"Codex reads ITPAY_API_KEY from its process environment; source ~/.itp/itpay.env before starting Codex if your launcher does not load it."
|
|
2483
2451
|
]
|
|
2484
2452
|
};
|
|
2485
2453
|
}
|
|
@@ -2489,7 +2457,7 @@ function installOpenClaw(grantId, credentials, dryRun) {
|
|
|
2489
2457
|
const current = readJSON(configPath, {});
|
|
2490
2458
|
current.models = current.models || {};
|
|
2491
2459
|
current.models.providers = current.models.providers || {};
|
|
2492
|
-
current.models.providers.
|
|
2460
|
+
current.models.providers.itpay = {
|
|
2493
2461
|
baseUrl: credentials.openai_base_url,
|
|
2494
2462
|
api: "openai-compatible",
|
|
2495
2463
|
apiKey: credentials.key,
|
|
@@ -2689,7 +2657,7 @@ async function skill(command, flags) {
|
|
|
2689
2657
|
if (!command || command === "show" || command === "read") {
|
|
2690
2658
|
const content = fs.readFileSync(skillPath, "utf8");
|
|
2691
2659
|
if (flags.json) {
|
|
2692
|
-
output({ skill:
|
|
2660
|
+
output({ skill: "itpay-buyer", role, path: skillPath, content });
|
|
2693
2661
|
} else {
|
|
2694
2662
|
process.stdout.write(content.endsWith("\n") ? content : `${content}\n`);
|
|
2695
2663
|
}
|
|
@@ -2697,7 +2665,7 @@ async function skill(command, flags) {
|
|
|
2697
2665
|
}
|
|
2698
2666
|
if (command === "path") {
|
|
2699
2667
|
if (flags.json) {
|
|
2700
|
-
output({ skill:
|
|
2668
|
+
output({ skill: "itpay-buyer", role, path: skillPath });
|
|
2701
2669
|
} else {
|
|
2702
2670
|
process.stdout.write(`${skillPath}\n`);
|
|
2703
2671
|
}
|
|
@@ -2709,7 +2677,6 @@ async function skill(command, flags) {
|
|
|
2709
2677
|
function normalizeSkillRole(role) {
|
|
2710
2678
|
const normalized = String(role || "buyer").trim().toLowerCase();
|
|
2711
2679
|
if (normalized === "buyer" || normalized === "itpay-buyer") return "buyer";
|
|
2712
|
-
if (normalized === "voltagent" || normalized === "legacy") return "voltagent";
|
|
2713
2680
|
if (normalized === "merchant" || normalized === "itpay-merchant") {
|
|
2714
2681
|
throw new Error("merchant skill is not packaged yet; use --role buyer for current external-agent tests");
|
|
2715
2682
|
}
|
|
@@ -2717,8 +2684,8 @@ function normalizeSkillRole(role) {
|
|
|
2717
2684
|
}
|
|
2718
2685
|
|
|
2719
2686
|
function resolveSkillPath(role = "buyer") {
|
|
2720
|
-
const skillDirName =
|
|
2721
|
-
const envPath =
|
|
2687
|
+
const skillDirName = "itpay-buyer";
|
|
2688
|
+
const envPath = process.env.ITPAY_BUYER_SKILL_PATH;
|
|
2722
2689
|
const candidates = [
|
|
2723
2690
|
envPath,
|
|
2724
2691
|
process.env.ITPAY_CLI_SKILL_PATH,
|
|
@@ -2771,7 +2738,7 @@ async function doctorModelCheck(target, credentials) {
|
|
|
2771
2738
|
function runtimeConfigStatus(target) {
|
|
2772
2739
|
const paths = {
|
|
2773
2740
|
"claude-code": [path.join(os.homedir(), ".claude", "settings.json")],
|
|
2774
|
-
codex: [path.join(os.homedir(), ".codex", "config.toml"), path.join(CONFIG_DIR, "
|
|
2741
|
+
codex: [path.join(os.homedir(), ".codex", "config.toml"), path.join(CONFIG_DIR, "itpay.env")],
|
|
2775
2742
|
openclaw: [path.join(os.homedir(), ".openclaw", "config.json")]
|
|
2776
2743
|
};
|
|
2777
2744
|
return (paths[target] || []).map((file) => ({
|
|
@@ -3989,7 +3956,7 @@ function writeSessionCredentials(response) {
|
|
|
3989
3956
|
|
|
3990
3957
|
function storeSessionCredential(response) {
|
|
3991
3958
|
const token = response.session_token;
|
|
3992
|
-
const ref = `
|
|
3959
|
+
const ref = `itpay:session:${response.account_id}:${response.device_id}`;
|
|
3993
3960
|
const nativeStore = writeNativeSecret(ref, token);
|
|
3994
3961
|
if (nativeStore.ok) {
|
|
3995
3962
|
return {
|
|
@@ -4071,7 +4038,7 @@ function deleteGrantCredential(grantId) {
|
|
|
4071
4038
|
}
|
|
4072
4039
|
|
|
4073
4040
|
function grantSecretRef(grantId) {
|
|
4074
|
-
return `
|
|
4041
|
+
return `itpay:${grantId}`;
|
|
4075
4042
|
}
|
|
4076
4043
|
|
|
4077
4044
|
function detectNativeCredentialStore() {
|
|
@@ -4093,7 +4060,7 @@ function writeNativeSecret(ref, secret) {
|
|
|
4093
4060
|
"-a",
|
|
4094
4061
|
ref,
|
|
4095
4062
|
"-s",
|
|
4096
|
-
"
|
|
4063
|
+
"ItPay",
|
|
4097
4064
|
"-w",
|
|
4098
4065
|
secret,
|
|
4099
4066
|
"-U"
|
|
@@ -4107,9 +4074,9 @@ function writeNativeSecret(ref, secret) {
|
|
|
4107
4074
|
try {
|
|
4108
4075
|
execFileSync("secret-tool", [
|
|
4109
4076
|
"store",
|
|
4110
|
-
"--label=
|
|
4077
|
+
"--label=ItPay",
|
|
4111
4078
|
"service",
|
|
4112
|
-
"
|
|
4079
|
+
"ItPay",
|
|
4113
4080
|
"account",
|
|
4114
4081
|
ref
|
|
4115
4082
|
], { input: secret, stdio: ["pipe", "ignore", "ignore"] });
|
|
@@ -4141,7 +4108,7 @@ function readNativeSecret(store, ref) {
|
|
|
4141
4108
|
"-a",
|
|
4142
4109
|
ref,
|
|
4143
4110
|
"-s",
|
|
4144
|
-
"
|
|
4111
|
+
"ItPay",
|
|
4145
4112
|
"-w"
|
|
4146
4113
|
], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
4147
4114
|
}
|
|
@@ -4149,7 +4116,7 @@ function readNativeSecret(store, ref) {
|
|
|
4149
4116
|
return execFileSync("secret-tool", [
|
|
4150
4117
|
"lookup",
|
|
4151
4118
|
"service",
|
|
4152
|
-
"
|
|
4119
|
+
"ItPay",
|
|
4153
4120
|
"account",
|
|
4154
4121
|
ref
|
|
4155
4122
|
], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
@@ -4168,14 +4135,14 @@ function deleteNativeSecret(store, ref) {
|
|
|
4168
4135
|
"-a",
|
|
4169
4136
|
ref,
|
|
4170
4137
|
"-s",
|
|
4171
|
-
"
|
|
4138
|
+
"ItPay"
|
|
4172
4139
|
], { stdio: "ignore" });
|
|
4173
4140
|
}
|
|
4174
4141
|
if (store === "secret-tool") {
|
|
4175
4142
|
execFileSync("secret-tool", [
|
|
4176
4143
|
"clear",
|
|
4177
4144
|
"service",
|
|
4178
|
-
"
|
|
4145
|
+
"ItPay",
|
|
4179
4146
|
"account",
|
|
4180
4147
|
ref
|
|
4181
4148
|
], { stdio: "ignore" });
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"When auth completes, CLI should claim and store the buyer session so a repeat purchase by the same agent/device can skip auth."
|
|
95
95
|
],
|
|
96
96
|
"forbidden": [
|
|
97
|
-
"
|
|
97
|
+
"Use the UCP cart and buyer checkout commands for external-agent tests.",
|
|
98
98
|
"Do not pass a different variant in checkout after cart is created.",
|
|
99
99
|
"Do not create a second cart/checkout after a retryable timeout unless the user asks to abandon the previous one.",
|
|
100
100
|
"Do not buy enterprise precise lookup with only a vague brand/short name unless you have resolved the exact registered company name.",
|