@itpay/cli 2.0.2 → 2.0.5
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 +92 -142
- package/dist/src/client/backend.js +27 -9
- package/dist/src/commands/buy.js +84 -132
- package/dist/src/commands/cart.js +274 -169
- package/dist/src/commands/catalog.js +63 -38
- package/dist/src/commands/checkout.js +117 -78
- package/dist/src/commands/docs.js +97 -51
- package/dist/src/commands/guidance.js +87 -15
- package/dist/src/commands/install.js +50 -87
- package/dist/src/commands/next.js +45 -0
- package/dist/src/commands/order.js +44 -69
- package/dist/src/commands/orders.js +43 -15
- package/dist/src/commands/pay.js +51 -22
- package/dist/src/commands/readyz.js +8 -4
- package/dist/src/commands/refund.js +132 -14
- package/dist/src/commands/services.js +719 -148
- package/dist/src/main.js +711 -201
- package/dist/src/render/output.js +2 -3
- package/dist/src/state/cart_session.js +13 -17
- package/dist/src/state/client_context.js +4 -2
- package/dist/src/state/config.js +3 -5
- package/dist/src/state/device_authority.js +1 -1
- package/docs/agent/buyer/cart-checkout.json +27 -83
- package/docs/agent/buyer/install-and-setup.json +23 -67
- package/docs/agent/buyer/orders-refunds.json +31 -53
- package/docs/agent/buyer/payment-flow.json +24 -57
- package/docs/agent/buyer/quickstart.json +39 -162
- package/docs/agent/buyer/render-hosts.json +43 -57
- package/docs/cli-reference/agent-types.md +45 -0
- package/docs/cli-reference/commands/buy.md +167 -0
- package/docs/cli-reference/commands/cart/add.md +86 -0
- package/docs/cli-reference/commands/cart/clear.md +53 -0
- package/docs/cli-reference/commands/cart/index.md +30 -0
- package/docs/cli-reference/commands/cart/next.md +71 -0
- package/docs/cli-reference/commands/cart/remove.md +53 -0
- package/docs/cli-reference/commands/cart/show.md +65 -0
- package/docs/cli-reference/commands/catalog/index.md +26 -0
- package/docs/cli-reference/commands/catalog/list.md +45 -0
- package/docs/cli-reference/commands/checkout.md +74 -0
- package/docs/cli-reference/commands/docs/index.md +28 -0
- package/docs/cli-reference/commands/docs/list.md +51 -0
- package/docs/cli-reference/commands/docs/search.md +69 -0
- package/docs/cli-reference/commands/docs/show.md +68 -0
- package/docs/cli-reference/commands/install.md +112 -0
- package/docs/cli-reference/commands/next.md +87 -0
- package/docs/cli-reference/commands/order.md +92 -0
- package/docs/cli-reference/commands/orders.md +83 -0
- package/docs/cli-reference/commands/pay.md +103 -0
- package/docs/cli-reference/commands/readyz.md +39 -0
- package/docs/cli-reference/commands/refund/cancel.md +62 -0
- package/docs/cli-reference/commands/refund/create.md +85 -0
- package/docs/cli-reference/commands/refund/get.md +60 -0
- package/docs/cli-reference/commands/refund/index.md +33 -0
- package/docs/cli-reference/commands/refund/list.md +68 -0
- package/docs/cli-reference/commands/refund/watch.md +73 -0
- package/docs/cli-reference/commands/services/action.md +43 -0
- package/docs/cli-reference/commands/services/checkout.md +82 -0
- package/docs/cli-reference/commands/services/events.md +73 -0
- package/docs/cli-reference/commands/services/get.md +66 -0
- package/docs/cli-reference/commands/services/index.md +45 -0
- package/docs/cli-reference/commands/services/invoke.md +67 -0
- package/docs/cli-reference/commands/services/list.md +61 -0
- package/docs/cli-reference/commands/services/next.md +162 -0
- package/docs/cli-reference/commands/services/quote.md +59 -0
- package/docs/cli-reference/commands/services/read-result.md +98 -0
- package/docs/cli-reference/commands/services/start.md +53 -0
- package/docs/cli-reference/conventions.md +94 -0
- package/docs/cli-reference/index.md +64 -0
- package/package.json +1 -1
- package/skills/itpay-buyer/SKILL.md +47 -113
|
@@ -1,154 +1,88 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: itpay-buyer
|
|
3
3
|
description: >
|
|
4
|
-
Use the ItPay
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Use the ItPay CLI when a human asks an Agent to discover services, use a
|
|
5
|
+
capability, buy a result, show a Checkout, recover an interrupted flow,
|
|
6
|
+
read a human-granted result, or manage a refund.
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
# ItPay
|
|
9
|
+
# ItPay Buyer
|
|
10
10
|
|
|
11
|
-
Use the CLI as the control surface. Do not recreate
|
|
12
|
-
service-specific workflow. The backend returns the next valid actions for each
|
|
13
|
-
catalog item and Service Execution.
|
|
11
|
+
Use the CLI as the only ItPay control surface. Do not recreate API calls or hardcode a service-specific sequence.
|
|
14
12
|
|
|
15
13
|
## Bootstrap
|
|
16
14
|
|
|
17
15
|
```bash
|
|
18
16
|
npm install -g @itpay/cli
|
|
19
|
-
itpay
|
|
20
|
-
itpay
|
|
17
|
+
itpay install <agent_type> --json
|
|
18
|
+
itpay --agent-type <agent_type> readyz --json
|
|
19
|
+
itpay --agent-type <agent_type> docs show quickstart --json
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
only for an intentional override.
|
|
22
|
+
Supported types are `codex-desktop`, `codex-cli`, `claude-code-desktop`, `claude-code-cli`, and `workbuddy`. Use the real stable runtime type; Host is presentation only.
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
immediately after `itpay`, or set `ITPAY_AGENT_TYPE` once:
|
|
24
|
+
## Envelope Rule
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
itpay --agent-type codex-desktop catalog list --json
|
|
31
|
-
```
|
|
26
|
+
For every JSON response:
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
1. Read `status` and `result` as current facts.
|
|
29
|
+
2. Follow `instruction` when explaining or presenting those facts.
|
|
30
|
+
3. Execute at most the one `next.command`, filling only explicit placeholders or required user data.
|
|
31
|
+
4. Use `recovery` only when the normal next step cannot continue.
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
Do not print the whole envelope to the user. Return the useful result, a short explanation, and the next human action when needed.
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
## Golden Flow
|
|
41
36
|
|
|
42
37
|
```bash
|
|
43
38
|
itpay --agent-type <agent_type> catalog list --json
|
|
44
|
-
itpay --agent-type <agent_type> services start <service_id>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
2. Ask the server for the next step:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
itpay --agent-type <agent_type> services next <service_execution_id> --json
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
3. Execute the first applicable command from `next_actions` unchanged. Typical
|
|
54
|
-
commands are `services invoke`, `services action`, or `services checkout`.
|
|
55
|
-
Do not infer a capability ID or hardcode one service's sequence.
|
|
56
|
-
|
|
57
|
-
4. For a paid result, collect only contact fields requested by the CLI. Create
|
|
58
|
-
the checkout with the exact server-selected capability:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
itpay --agent-type <agent_type> services checkout <service_execution_id> \
|
|
62
|
-
--capability <capability_id> [--email <human_email>] --host <host> --json
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Include `--email` only when the CLI's `next_actions` command includes it. For a
|
|
66
|
-
protected delivery, explain that the address receives the order claim link;
|
|
67
|
-
never invent an address. Agent-visible paid results do not require email.
|
|
68
|
-
|
|
69
|
-
5. Show both handoff forms to the human:
|
|
70
|
-
|
|
71
|
-
- Attach `brand_qr_local_path` when `brand_qr_status` is `downloaded`.
|
|
72
|
-
- Print `checkout_url` as a clickable link.
|
|
73
|
-
- Keep `checkout_id`, `display_token`, and `service_execution_id` for recovery.
|
|
74
|
-
- Do not substitute a provider QR or call `itpay pay` in the normal buyer flow.
|
|
75
|
-
|
|
76
|
-
6. After the human pays, claims, or grants access, re-read server state:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
itpay --agent-type <agent_type> services next <service_execution_id> --json
|
|
80
|
-
itpay --agent-type <agent_type> services get <service_execution_id> --json
|
|
39
|
+
itpay --agent-type <agent_type> services start <service_id> --json
|
|
81
40
|
```
|
|
82
41
|
|
|
83
|
-
|
|
84
|
-
active:
|
|
42
|
+
Then execute the exact `next.command` returned by each step. It may invoke a capability, ask for a selection, create a Checkout, wait for human action, return an Agent-visible result, or read a protected result after grant.
|
|
85
43
|
|
|
86
|
-
|
|
87
|
-
itpay --agent-type <agent_type> services read-result <service_execution_id>
|
|
88
|
-
```
|
|
44
|
+
Rules:
|
|
89
45
|
|
|
90
|
-
|
|
91
|
-
|
|
46
|
+
- One independent service intent uses one Service Execution.
|
|
47
|
+
- Every candidate list belongs to its source Service Execution. After a human selects a rank, submit the selection on that same Execution; never copy it into a new Execution or construct a candidate.
|
|
48
|
+
- A paid step is `services quote -> cart add --quote -> buy --cart`. Quote locks service input and price; Cart may combine Quotes from separate Executions without merging their delivery.
|
|
49
|
+
- `services checkout` is the one-item shortcut for the same Quote, Cart and Checkout rules.
|
|
50
|
+
- Ask for required email/contact fields; explain their delivery purpose and never invent them.
|
|
51
|
+
- When Checkout is ready, make both the ItPay QR/image and URL visible on the current human surface.
|
|
52
|
+
- Normal payment happens on the ItPay Checkout page. `itpay pay` and `buy --pay` are operator escape hatches.
|
|
53
|
+
- Payment is confirmed only by Backend Checkout or Order state.
|
|
54
|
+
- Agent-visible results come from `services next`; do not call `read-result` for them.
|
|
55
|
+
- An Execution may have delivery history; always follow `services next` for the backend-selected current delivery instead of reusing an older result.
|
|
56
|
+
- Protected results require a current human grant. The grant is scoped to one delivery, approved fields and frozen Agent audience, and expires after 15 minutes.
|
|
57
|
+
- A pending refund locks every delivery path and revokes existing grants.
|
|
92
58
|
|
|
93
59
|
## Recovery
|
|
94
60
|
|
|
95
|
-
|
|
61
|
+
Before creating anything again:
|
|
96
62
|
|
|
97
63
|
```bash
|
|
98
64
|
itpay --agent-type <agent_type> next --json
|
|
99
65
|
itpay --agent-type <agent_type> services list --json
|
|
100
66
|
itpay --agent-type <agent_type> services next <service_execution_id> --json
|
|
101
67
|
itpay --agent-type <agent_type> services checkout <service_execution_id> --resume --json
|
|
102
|
-
itpay checkout --id <checkout_id> --token <display_token>
|
|
68
|
+
itpay checkout --id <checkout_id> --token <display_token> --json
|
|
69
|
+
itpay --agent-type <agent_type> refund get <refund_request_id> --json
|
|
103
70
|
```
|
|
104
71
|
|
|
105
|
-
|
|
106
|
-
create a second order. Local files cache recovery handles; canonical cart,
|
|
107
|
-
quota, execution, checkout, delivery, and grant state comes from the backend.
|
|
72
|
+
## Safety
|
|
108
73
|
|
|
109
|
-
|
|
74
|
+
- Never invent service, capability, item, Checkout, Order, grant, or refund IDs.
|
|
75
|
+
- Never expose Provider credentials, raw payloads, display tokens as standalone chat data, Buyer bearer tokens, or Device private keys.
|
|
76
|
+
- Never bypass ownership, compatibility, quota, grant, or refund-lock errors.
|
|
77
|
+
- Do not use `services events` in a normal flow; it is a bounded redacted diagnostic command.
|
|
78
|
+
- Do not rotate Agent Type or local identity to reset free quota.
|
|
110
79
|
|
|
111
|
-
|
|
112
|
-
human sees the output. They are separate.
|
|
113
|
-
|
|
114
|
-
| Human surface | CLI options |
|
|
115
|
-
| --- | --- |
|
|
116
|
-
| Codex | `--host codex` |
|
|
117
|
-
| Claude Code | `--host claude-code` |
|
|
118
|
-
| Terminal | `--host terminal` |
|
|
119
|
-
| Telegram | `--host telegram --target <chat_id>` |
|
|
120
|
-
| Feishu/Lark | `--host feishu --target <id>` or `--host lark --target <id>` |
|
|
121
|
-
|
|
122
|
-
Run `itpay install <host>` for host-specific setup.
|
|
123
|
-
|
|
124
|
-
## Progressive Disclosure
|
|
125
|
-
|
|
126
|
-
- Run one state-changing command at a time.
|
|
127
|
-
- Return the useful result, a short explanation, and the next executable step.
|
|
128
|
-
- Ask the human only for a missing required field such as delivery email.
|
|
129
|
-
- When checkout is ready, visibly attach the QR and print the payment link.
|
|
130
|
-
- Prefer CLI `next_actions`; do not dump internal timelines unless diagnosing.
|
|
131
|
-
- Use `--json` for agent parsing and normal rendering for the human handoff.
|
|
132
|
-
|
|
133
|
-
## Safety Rules
|
|
134
|
-
|
|
135
|
-
1. Never invent catalog, service, capability, result-item, checkout, or order IDs.
|
|
136
|
-
2. Never expose provider credentials, raw provider metadata, bearer tokens, or device private keys.
|
|
137
|
-
3. Do not treat QR rendering or a human statement as payment confirmation.
|
|
138
|
-
4. Do not call `itpay pay` or use `buy --pay` for a normal checkout; those are operator escape hatches.
|
|
139
|
-
5. Do not create a new execution or checkout until recovery confirms the prior one is unusable.
|
|
140
|
-
6. Do not claim protected access before `services read-result` succeeds.
|
|
141
|
-
7. Do not invent admin, account, grant-creation, or provider-specific CLI commands.
|
|
142
|
-
|
|
143
|
-
## Built-in Docs
|
|
80
|
+
## Built-In Help
|
|
144
81
|
|
|
145
82
|
```bash
|
|
146
|
-
itpay docs list
|
|
147
|
-
itpay docs search <term>
|
|
148
|
-
itpay docs show
|
|
149
|
-
itpay docs show cart-checkout
|
|
150
|
-
itpay docs show payment-flow
|
|
151
|
-
itpay docs show orders-refunds
|
|
152
|
-
itpay docs show render-hosts
|
|
153
|
-
itpay docs show install-and-setup
|
|
83
|
+
itpay docs list --json
|
|
84
|
+
itpay docs search <term> --json
|
|
85
|
+
itpay docs show <topic> --json
|
|
154
86
|
```
|
|
87
|
+
|
|
88
|
+
The normative command contracts are packaged under `docs/cli-reference`.
|