@itpay/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.
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: itpay-buyer
3
+ description: >
4
+ Use this skill when an AI agent helps a human discover, choose, buy, pay for,
5
+ or receive an ItPay service through the `itp` CLI. This is a quick-start
6
+ directory and safety boundary for buyer agents; detailed flow guidance lives
7
+ in `itp docs ... --role buyer --json`.
8
+ ---
9
+
10
+ # ItPay Buyer Agent Skill
11
+
12
+ You are acting as an ItPay buyer agent. Your job is to help the human discover
13
+ services, choose an option, add the selected variant to cart, create checkout,
14
+ show first-purchase account authorization when required, show the returned
15
+ payment QR, wait for verified payment, and report redacted secure delivery
16
+ status.
17
+
18
+ This skill is intentionally short. Do not try to memorize the entire ItPay
19
+ protocol from this file. Use the CLI docs graph whenever you need details.
20
+
21
+ ## Start Here
22
+
23
+ Run these commands before buying:
24
+
25
+ ```bash
26
+ itp docs show quickstart --role buyer --json
27
+ itp docs list --role buyer --json
28
+ ```
29
+
30
+ If you are confused, search the agent docs instead of guessing:
31
+
32
+ ```bash
33
+ itp docs search "<what you need to know>" --role buyer --json
34
+ ```
35
+
36
+ ## Standard Buyer Flow
37
+
38
+ ```text
39
+ read this skill
40
+ -> read quickstart doc
41
+ -> search catalog
42
+ -> explain/recommend a variant
43
+ -> collect required service input and buyer delivery email
44
+ -> create cart with selected UCP Variant.id
45
+ -> create checkout from cart_id
46
+ -> if auth_qr is returned, show it for Alipay login/registration consent
47
+ -> poll/resume checkout until payment_intent_id appears
48
+ -> show returned payment QR exactly
49
+ -> wait for payment_intent.verified
50
+ -> check redacted delivery status
51
+ -> tell the human to check email / ItPay secure claim UI
52
+ -> if the human grants agent-readable access with Passkey, discover and read only the approved vault fields
53
+ ```
54
+
55
+ The high-level command can wrap this flow:
56
+
57
+ ```bash
58
+ itp buy <variant_id> --sandbox --email <buyer_email> --phone <buyer_phone> --json
59
+ ```
60
+
61
+ For step-by-step testing:
62
+
63
+ ```bash
64
+ itp buyer catalog search --query "<user request>" --json
65
+ itp buyer catalog search --query "企业工商信息 查询" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --json
66
+ itp buyer catalog get --variant <variant_id> --json
67
+ itp buyer cart create --variant <variant_id> --json
68
+ itp buyer cart create --variants <variant_id_1>,<variant_id_2> --quantities 1,1 --json
69
+ itp buyer cart show <cart_id> --json
70
+ itp buyer cart add <cart_id> --variant <variant_id> --quantity 1 --json
71
+ itp buyer cart remove <cart_id> --line <cart_line_item_id> --json
72
+ itp buyer checkout create --cart <cart_id> --email <buyer_email> --phone <buyer_phone> --json
73
+ itp buyer checkout resume <checkout_id> --json
74
+ itp buyer payment wait <payment_intent_id> --json
75
+ itp buyer checkout status <checkout_id> --json
76
+ itp buyer vault grants list --checkout <checkout_id> --json
77
+ itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --json
78
+ ```
79
+
80
+ For API products, read the product metadata input schema before cart creation.
81
+ Enterprise data products require query input at cart time:
82
+
83
+ ```bash
84
+ itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=京东 --json
85
+ itp buyer cart create --variant var_itpay_enterprise_precise_lookup_cny05 --input company_name_or_credit_no=北京京东世纪贸易有限公司 --json
86
+ itp buy var_itpay_enterprise_fuzzy_search_cny01 --sandbox --email <buyer_email> --input company_name=京东 --json
87
+ ```
88
+
89
+ Use fuzzy search when the user gives a short name, brand, keyword, or uncertain
90
+ entity. Use precise lookup only after you have the exact China mainland
91
+ registered company name or unified social credit code. If the user says
92
+ "京东" or "那个京东商城", do not buy precise lookup until you resolve the exact
93
+ registered name or run fuzzy search first.
94
+
95
+ ## Non-Negotiable Rules
96
+
97
+ 1. Use `--json` for every ItPay command.
98
+ 2. Do not invent service IDs, variant IDs, checkout IDs, payment URLs, QR URLs,
99
+ payment intent IDs, delivery IDs, or claim links.
100
+ 3. When the user asks for several compatible services, create one cart with
101
+ `--variants` and one checkout. Split only when ItPay rejects the cart or
102
+ explicitly says split checkout is required.
103
+ 4. Before checkout, make sure a buyer delivery email is available. If the CLI
104
+ has no known buyer email, ask the human for the email; do not invent one,
105
+ do not use placeholders, and do not proceed to checkout without it. The
106
+ email is used for human-first secure delivery and account/order access.
107
+ 5. Do not rewrite, shorten, re-encode, translate, or replace QR URLs. For
108
+ payment QR display, you must show `local_qr_path` when the CLI provides it;
109
+ remote QR images may not render in every agent client. If no local file is
110
+ present, use `qr_png_url` / `preferred_qr_url`, and use `qr_image_url` only
111
+ as fallback. These are ItPay-hosted human QR images; they may render a
112
+ native provider payment code for scanner reliability, but you must not
113
+ request, decode, or expose the raw provider payload.
114
+ 6. If `human_action.kind=auth_qr`, it is account login/registration consent,
115
+ not payment. Show the ItPay auth entry (`url`, `web_url`, or local/PNG QR)
116
+ as the primary human action, then poll/resume checkout until payment QR
117
+ appears. `oauth_start_url` is provider fallback/debug, not the primary agent
118
+ handoff.
119
+ 7. Do not treat QR display, page open, or user text like "I paid" as payment
120
+ proof. Payment proof for the agent is `payment_intent.verified`.
121
+ 8. Do not ask the human to paste raw keys, redeem codes, claim links, claim
122
+ tokens, session tokens, provider payloads, or secrets into chat.
123
+ 9. Do not call ops commands, worker routes, provider query recovery, or fixture
124
+ evidence routes from the buyer flow.
125
+ 10. Secure delivery is human-first. The agent may report
126
+ `delivery_claimable`, `check_email`, and `claim_link_sent`, but must not
127
+ fetch or reveal protected content.
128
+ 11. If the human uses Passkey to authorize agent-readable vault access, do not
129
+ ask them to paste content, portal text, claim links, or grant IDs. Run
130
+ `itp buyer vault grants list ...` and then `itp buyer vault read ...`.
131
+ Use only the fields returned by that command.
132
+ 12. If the user asks you to analyze, compare, summarize, install, or otherwise
133
+ use a delivered result, you may ask them to open the ItPay claim/account
134
+ page, click "Give to Agent / 一键给 Agent", choose fields, and confirm with
135
+ Passkey. After they approve, probe with `itp buyer vault grants list ...`;
136
+ do not ask them to copy a grant id.
137
+ 13. Prefer resume/wait over creating duplicate checkouts.
138
+ 14. Do not create a cart for an API service until all required service input
139
+ fields are known. For enterprise fuzzy search, `company_name` can be a
140
+ broad keyword. For enterprise precise lookup, `company_name_or_credit_no`
141
+ must be exact; otherwise warn the user that the query may waste the paid
142
+ lookup.
143
+
144
+ ## Docs Directory
145
+
146
+ Use these docs pages as needed:
147
+
148
+ ```bash
149
+ itp docs show catalog-search --role buyer --json
150
+ itp docs show product-recommendation --role buyer --json
151
+ itp docs show cart-checkout --role buyer --json
152
+ itp docs show payment-qr --role buyer --json
153
+ itp docs show payment-wait --role buyer --json
154
+ itp docs show qr-refresh --role buyer --json
155
+ itp docs show secure-delivery --role buyer --json
156
+ itp docs show human-claim-ui --role buyer --json
157
+ itp docs show account-portal --role buyer --json
158
+ itp docs show vault-agent-read --role buyer --json
159
+ itp docs show recovery --role buyer --json
160
+ itp docs show safety-policy --role buyer --json
161
+ ```
162
+
163
+ Each docs page includes `next_docs`. Follow those links as the state changes.
164
+
165
+ For payment creation in an agent/chat client, prefer:
166
+
167
+ ```bash
168
+ itp buy <variant_id> --sandbox --email <buyer_email> --phone <buyer_phone> --display agent --json
169
+ ```
170
+
171
+ This keeps JSON output machine-readable while allowing the CLI to prepare a
172
+ local QR image path for clients that cannot render remote SVG reliably. If the
173
+ human is on mobile, present `mobile_wallet_url` as a clickable human-only
174
+ fallback; do not convert it into a QR.
175
+
176
+ For first-purchase auth, treat the returned ItPay authorization entry as a
177
+ single human orchestration entry. It may open Alipay login/registration first
178
+ and then payment after ItPay receives the OAuth callback. Do not call
179
+ `oauth_start_url` directly unless the ItPay auth page asks for fallback.
180
+ If the payment page says the Alipay sandbox entry is stabilizing/preparing,
181
+ or if Alipay sandbox says "order not found", tell the human to wait 30-60
182
+ seconds and use the same page/QR again. Do not ask them to refresh repeatedly,
183
+ and do not create another checkout or payment intent. Use
184
+ `itp buyer payment refresh-qr ... --reason order-not-found` only after the
185
+ same QR/page has been retried and still fails; ItPay may safely return the same
186
+ valid QR rather than creating a new provider order.
187
+
188
+ ## Safe User Message Pattern
189
+
190
+ When reporting progress, keep it short:
191
+
192
+ ```text
193
+ I found the service and selected the matching variant.
194
+ I created the cart and checkout.
195
+ Please open the returned ItPay authorization link and approve Alipay login.
196
+ I am waiting for ItPay account authorization.
197
+ Please scan the returned ItPay-hosted QR image with Alipay sandbox.
198
+ I am waiting for ItPay payment verification.
199
+ Payment is verified.
200
+ Delivery is claimable by the human buyer. Please check your email.
201
+ ```
202
+
203
+ Do not include raw protected content in the message.