@itpay/cli 0.2.12 → 0.2.14

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 CHANGED
@@ -85,7 +85,7 @@ Non-interactive agent hosts such as Codex automatically use file storage to
85
85
  avoid OS keychain prompts. To force file storage anywhere:
86
86
 
87
87
  ```bash
88
- ITP_CREDENTIAL_STORE=file itp buyer auth status --json
88
+ ITP_CREDENTIAL_STORE=file itp buyer auth status --host <client> --json
89
89
  ```
90
90
 
91
91
  If native credential storage is unavailable, the CLI falls back to:
@@ -101,7 +101,7 @@ The fallback file is written with `0600` permissions.
101
101
  After a buyer has completed first-purchase auth and the CLI has a buyer account session, an agent can create a one-time link for the human to view the ItPay account/order portal:
102
102
 
103
103
  ```bash
104
- itp account login-link --json
104
+ itp account login-link --host <client> --json
105
105
  ```
106
106
 
107
107
  The agent should give the returned `login_url` to the human and must not open or scrape it. The portal shows the same redacted order/vault state available through buyer APIs; raw artifact reveal remains a separate human Passkey/WebAuthn flow.
@@ -155,9 +155,15 @@ from the current state.
155
155
  Before starting a new purchase, agents should inspect recoverable local state:
156
156
 
157
157
  ```bash
158
- itp status --refresh --json
158
+ itp status --refresh --host <client> --json
159
159
  ```
160
160
 
161
+ Every non-doc command needs a client context. Use `--host codex`,
162
+ `--host claude-code`, `--host terminal`, or `--host plain-chat`. For OpenClaw
163
+ Telegram private/group chat, use `--host telegram --target <inbound_meta.chat_id>`.
164
+ If the CLI returns `client_context_required` or `client_target_required`, rerun
165
+ the same command with the requested fields.
166
+
161
167
  Humans can use the default account overview:
162
168
 
163
169
  ```bash
@@ -174,7 +180,7 @@ Device: Codex on MacBook-Pro (active)
174
180
  If an unfinished run exists, continue it:
175
181
 
176
182
  ```bash
177
- itp resume --run-id <run_id> --json
183
+ itp resume --run-id <run_id> --host <client> --json
178
184
  ```
179
185
 
180
186
  ## Install From This Repo
@@ -211,26 +217,26 @@ show the human QR/payment entry, wait for verified payment, and report only
211
217
  redacted secure delivery status:
212
218
 
213
219
  ```bash
214
- itp buyer catalog search --query 企业工商 --json
215
- itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=阿里 --json
216
- itp buyer checkout create --cart <cart_id> --email <buyer_email> --json
217
- itp buyer payment wait <payment_intent_id> --timeout 1 --json
218
- itp buyer checkout status <checkout_id> --json
220
+ itp buyer catalog search --query 企业工商 --host <client> --json
221
+ itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=阿里 --host <client> --json
222
+ itp buyer checkout create --cart <cart_id> --email <buyer_email> --host <client> --json
223
+ itp buyer payment wait <payment_intent_id> --timeout 1 --host <client> --json
224
+ itp buyer checkout status <checkout_id> --host <client> --json
219
225
  ```
220
226
 
221
227
  For the one-command buyer helper:
222
228
 
223
229
  ```bash
224
- itp buy var_itpay_enterprise_fuzzy_search_cny01 --email <buyer_email> --input company_name=阿里 --display agent --no-wait-payment --json
230
+ itp buy var_itpay_enterprise_fuzzy_search_cny01 --email <buyer_email> --input company_name=阿里 --display agent --no-wait-payment --host <client> --json
225
231
  ```
226
232
 
227
233
  For multi-item cart tests:
228
234
 
229
235
  ```bash
230
- itp buyer cart create --variants var_itpay_enterprise_precise_lookup_cny05,var_itpay_enterprise_fuzzy_search_cny01 --quantities 1,1 --json
231
- itp buyer cart show <cart_id> --json
232
- itp buyer cart add <cart_id> --variant var_itpay_enterprise_fuzzy_search_cny01 --quantity 1 --json
233
- itp buyer cart remove <cart_id> --line <cart_line_item_id> --json
236
+ itp buyer cart create --variants var_itpay_enterprise_precise_lookup_cny05,var_itpay_enterprise_fuzzy_search_cny01 --quantities 1,1 --host <client> --json
237
+ itp buyer cart show <cart_id> --host <client> --json
238
+ itp buyer cart add <cart_id> --variant var_itpay_enterprise_fuzzy_search_cny01 --quantity 1 --host <client> --json
239
+ itp buyer cart remove <cart_id> --line <cart_line_item_id> --host <client> --json
234
240
  ```
235
241
 
236
242
  Payment QR rules:
@@ -239,9 +245,9 @@ Payment QR rules:
239
245
  - Otherwise render the ItPay-hosted `qr_png_url` / `preferred_qr_url`.
240
246
  - Use `mobile_wallet_url` only as a human mobile fallback.
241
247
  - Do not generate your own QR from payment URLs.
242
- - In OpenClaw Telegram, use root `agent_instruction.openclaw_message.command_args` with `openclaw message send`; do not simulate buttons in normal prose.
248
+ - In OpenClaw Telegram, run root `agent_action.command` or `agent_action.argv` before replying; do not simulate buttons in normal prose.
243
249
  - Telegram native buttons require `presentation.blocks[].type="buttons"` with `text/url/callback_data`.
244
- - If `human_output_required=true` appears for another client, send root `human_output` before any next ItPay command.
250
+ - For Codex/Claude Code, send root `agent_instruction.markdown` before any next ItPay command.
245
251
  - If status is `payment_handoff_required`, `next` is the human reply step, not payment wait.
246
252
  - Treat only `payment_intent.verified` as payment success.
247
253
 
@@ -250,9 +256,9 @@ the artifact in the ItPay account portal with Passkey and choose "Give to
250
256
  Agent". The agent then discovers the approved grant itself:
251
257
 
252
258
  ```bash
253
- itp buyer vault grants list --checkout <checkout_id> --json
254
- itp buyer vault grants read <agent_read_grant_id> --json
255
- itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --json
259
+ itp buyer vault grants list --checkout <checkout_id> --host <client> --json
260
+ itp buyer vault grants read <agent_read_grant_id> --host <client> --json
261
+ itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --host <client> --json
256
262
  ```
257
263
 
258
264
  Agents must not ask humans to paste claim links, claim tokens, raw API results,
@@ -262,7 +268,7 @@ Order/account/refund commands require a server-verified buyer session, not a
262
268
  vault grant. If they fail with a buyer session error, run:
263
269
 
264
270
  ```bash
265
- itp status --refresh --json
271
+ itp status --refresh --host <client> --json
266
272
  ```
267
273
 
268
274
  Then follow the returned `next.command`.
package/bin/itp CHANGED
@@ -4,6 +4,7 @@ import { output, outputError, parseFlags, readState, VERSION } from "../lib/env.
4
4
  import { docs, skill } from "../lib/docs.js";
5
5
  import { ops, admin } from "../lib/ops.js";
6
6
  import { buyer, buyerBuy } from "../lib/buyer.js";
7
+ import { clientContextGate } from "../lib/client-context.js";
7
8
  import {
8
9
  accountLoginLink, accountSetPassword, accountShow, agentStatus, authDevice, authLogin, authRegister, authStatus, balance,
9
10
  checkoutCreate, checkoutList, checkoutOpen, checkoutQR, checkoutRecover, doctor, grantsInstall, grantsList, grantsRevoke,
@@ -23,6 +24,11 @@ async function main() {
23
24
  }
24
25
 
25
26
  const [group, command, ...rest] = args;
27
+ const contextGate = clientContextGate(args);
28
+ if (contextGate) {
29
+ output(contextGate);
30
+ return;
31
+ }
26
32
  const flags = parseFlags(rest);
27
33
 
28
34
  if (group === "usage") return usage(parseFlags(args.slice(1)));
@@ -93,41 +99,41 @@ async function main() {
93
99
  output({
94
100
  version: VERSION,
95
101
  commands: [
96
- "buy var_pubg_couple_skin_cny20 --email <buyer_email> --phone +8613800000000 --display agent --no-wait-payment --json",
97
- "buy var_pubg_couple_skin_cny20 --email <buyer_email> --phone +8613800000000 --no-wait --json",
98
- "buyer catalog search --query 企业工商 --category business_data_api --provider itpay_enterprise_data --json",
99
- "buyer catalog get --variant var_pubg_couple_skin_cny20 --json",
100
- "buyer cart create --variant var_pubg_couple_skin_cny20 --json",
101
- "buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=京东 --json",
102
- "buyer cart show <cart_id> --json",
103
- "buyer cart add <cart_id> --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=美团 --quantity 1 --json",
104
- "buyer cart remove <cart_id> --line <cart_line_item_id> --json",
105
- "buyer shelf manifest --json",
106
- "buyer shelf snapshot --version <catalog_version> --json",
107
- "buyer shelf delta --since <catalog_version> --json",
108
- "buyer checkout create --cart <cart_id> --method alipay --email <buyer_email> --phone +8613800000000 --json",
109
- "buyer checkout status <checkout_id> --json",
110
- "buyer checkout resume <checkout_id> --json",
111
- "buyer auth status --json",
112
- "buyer payment wait <payment_intent_id> --timeout 1 --json",
113
- "buyer payment refresh-qr <payment_intent_id> --reason order-not-found --json",
114
- "buyer deliveries list --checkout <checkout_id> --json",
115
- "buyer deliveries show <delivery_id> --checkout <checkout_id> --json",
116
- "buyer refund create --order <order_id> --amount-minor 1000 --currency CNY --reason buyer_requested --json",
117
- "buyer refund list --order <order_id> --json",
118
- "buyer refund show <refund_id> --json",
119
- "buyer refund cancel <refund_id> --reason buyer_changed_mind --json",
120
- "buyer vault grants list --checkout <checkout_id> --json",
121
- "buyer vault grants read <agent_read_grant_id> --json",
122
- "buyer vault read --order <order_id> --artifact <vault_artifact_id> --json",
123
- "account login-link --json",
124
- "status --json",
125
- "status --refresh --json",
102
+ "buy var_pubg_couple_skin_cny20 --email <buyer_email> --phone +8613800000000 --display agent --no-wait-payment --host <client> --json",
103
+ "buy var_pubg_couple_skin_cny20 --email <buyer_email> --phone +8613800000000 --no-wait --host <client> --json",
104
+ "buyer catalog search --query 企业工商 --category business_data_api --provider itpay_enterprise_data --host <client> --json",
105
+ "buyer catalog get --variant var_pubg_couple_skin_cny20 --host <client> --json",
106
+ "buyer cart create --variant var_pubg_couple_skin_cny20 --host <client> --json",
107
+ "buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=京东 --host <client> --json",
108
+ "buyer cart show <cart_id> --host <client> --json",
109
+ "buyer cart add <cart_id> --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=美团 --quantity 1 --host <client> --json",
110
+ "buyer cart remove <cart_id> --line <cart_line_item_id> --host <client> --json",
111
+ "buyer shelf manifest --host <client> --json",
112
+ "buyer shelf snapshot --version <catalog_version> --host <client> --json",
113
+ "buyer shelf delta --since <catalog_version> --host <client> --json",
114
+ "buyer checkout create --cart <cart_id> --method alipay --email <buyer_email> --phone +8613800000000 --host <client> --json",
115
+ "buyer checkout status <checkout_id> --host <client> --json",
116
+ "buyer checkout resume <checkout_id> --host <client> --json",
117
+ "buyer auth status --host <client> --json",
118
+ "buyer payment wait <payment_intent_id> --timeout 1 --host <client> --json",
119
+ "buyer payment refresh-qr <payment_intent_id> --reason order-not-found --host <client> --json",
120
+ "buyer deliveries list --checkout <checkout_id> --host <client> --json",
121
+ "buyer deliveries show <delivery_id> --checkout <checkout_id> --host <client> --json",
122
+ "buyer refund create --order <order_id> --amount-minor 1000 --currency CNY --reason buyer_requested --host <client> --json",
123
+ "buyer refund list --order <order_id> --host <client> --json",
124
+ "buyer refund show <refund_id> --host <client> --json",
125
+ "buyer refund cancel <refund_id> --reason buyer_changed_mind --host <client> --json",
126
+ "buyer vault grants list --checkout <checkout_id> --host <client> --json",
127
+ "buyer vault grants read <agent_read_grant_id> --host <client> --json",
128
+ "buyer vault read --order <order_id> --artifact <vault_artifact_id> --host <client> --json",
129
+ "account login-link --host <client> --json",
130
+ "status --host <client> --json",
131
+ "status --refresh --host <client> --json",
126
132
  "docs list --role buyer --json",
127
133
  "docs show quickstart --role buyer --json",
128
134
  "docs search <question> --role buyer --json",
129
- "resume --json",
130
- "resume --run-id <run_id> --host gemini --display none --json",
135
+ "resume --host <client> --json",
136
+ "resume --run-id <run_id> --host codex --display none --json",
131
137
  "runs list|current|show <run_id>|forget <run_id>",
132
138
  "account login-link",
133
139
  "skill show",
@@ -10,23 +10,29 @@
10
10
  "The agent needs to explain that human UI and agent status share the same redacted order state."
11
11
  ],
12
12
  "required_state": {
13
- "needs": ["authenticated buyer account session"],
14
- "must_not_need": ["claim token", "raw content", "portal page contents"]
13
+ "needs": [
14
+ "authenticated buyer account session"
15
+ ],
16
+ "must_not_need": [
17
+ "claim token",
18
+ "raw content",
19
+ "portal page contents"
20
+ ]
15
21
  },
16
22
  "commands": [
17
23
  {
18
24
  "intent": "create a one-time human account portal link",
19
- "command": "itp account login-link --json",
25
+ "command": "itp account login-link --host <client> --json",
20
26
  "success_signal": "response.status == account_portal_login_link_created and response.portal_login_link.one_time == true"
21
27
  },
22
28
  {
23
29
  "intent": "same command under buyer namespace",
24
- "command": "itp buyer account login-link --json",
30
+ "command": "itp buyer account login-link --host <client> --json",
25
31
  "success_signal": "response.login_url is present"
26
32
  },
27
33
  {
28
34
  "intent": "agent-side state check without opening the human portal",
29
- "command": "itp buyer checkout status <checkout_id> --json",
35
+ "command": "itp buyer checkout status <checkout_id> --host <client> --json",
30
36
  "success_signal": "response contains redacted order/delivery state only"
31
37
  }
32
38
  ],
@@ -61,5 +67,15 @@
61
67
  "command": "itp docs show safety-policy --role buyer --json"
62
68
  }
63
69
  ],
64
- "search_terms": ["account portal", "orders", "login link", "one time link", "portal", "账号", "订单", "登录链接", "一次性链接"]
70
+ "search_terms": [
71
+ "account portal",
72
+ "orders",
73
+ "login link",
74
+ "one time link",
75
+ "portal",
76
+ "账号",
77
+ "订单",
78
+ "登录链接",
79
+ "一次性链接"
80
+ ]
65
81
  }
@@ -28,47 +28,47 @@
28
28
  "commands": [
29
29
  {
30
30
  "intent": "create a cart estimate for the selected purchase option",
31
- "command": "itp buyer cart create --variant <variant_id> --json",
31
+ "command": "itp buyer cart create --variant <variant_id> --host <client> --json",
32
32
  "success_signal": "response.cart.cart_id is present and response.cart_guidance tells the agent to show the cart to the human before checkout"
33
33
  },
34
34
  {
35
35
  "intent": "create a multi-item cart estimate for selected purchase options",
36
- "command": "itp buyer cart create --variants <variant_id_1>,<variant_id_2> --quantities 1,2 --json",
36
+ "command": "itp buyer cart create --variants <variant_id_1>,<variant_id_2> --quantities 1,2 --host <client> --json",
37
37
  "success_signal": "response.cart.line_items contains every selected purchase option and response.cart_guidance.double_check_required is true"
38
38
  },
39
39
  {
40
40
  "intent": "create an enterprise fuzzy search cart with required query input",
41
- "command": "itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=京东 --json",
41
+ "command": "itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=京东 --host <client> --json",
42
42
  "success_signal": "response.cart.cart_id is present; the raw provider result is not visible to the agent"
43
43
  },
44
44
  {
45
45
  "intent": "create an enterprise precise lookup cart with exact registered name or credit code",
46
- "command": "itp buyer cart create --variant var_itpay_enterprise_precise_lookup_cny05 --input company_name_or_credit_no=北京京东世纪贸易有限公司 --json",
46
+ "command": "itp buyer cart create --variant var_itpay_enterprise_precise_lookup_cny05 --input company_name_or_credit_no=北京京东世纪贸易有限公司 --host <client> --json",
47
47
  "success_signal": "response.cart.cart_id is present; payment can proceed only after the exact query input is locked into the cart line"
48
48
  },
49
49
  {
50
50
  "intent": "view the current cart state without relying on model memory",
51
- "command": "itp buyer cart show <cart_id> --json",
51
+ "command": "itp buyer cart show <cart_id> --host <client> --json",
52
52
  "success_signal": "response.cart.line_items and response.cart.totals reflect the server-side cart; show these fields to the human before checkout"
53
53
  },
54
54
  {
55
55
  "intent": "add one more selected UCP Variant.id to an existing cart before checkout",
56
- "command": "itp buyer cart add <cart_id> --variant <variant_id> --input key=value --quantity 1 --json",
56
+ "command": "itp buyer cart add <cart_id> --variant <variant_id> --input key=value --quantity 1 --host <client> --json",
57
57
  "success_signal": "response.cart.cart_id is unchanged; response.cart.line_items either includes a new line for different input/settings or increments quantity for an identical line"
58
58
  },
59
59
  {
60
60
  "intent": "remove one line from an existing cart before checkout",
61
- "command": "itp buyer cart remove <cart_id> --line <cart_line_item_id> --json",
61
+ "command": "itp buyer cart remove <cart_id> --line <cart_line_item_id> --host <client> --json",
62
62
  "success_signal": "response.cart.cart_id is unchanged and response.cart.line_items no longer contains that line id"
63
63
  },
64
64
  {
65
65
  "intent": "create checkout from cart_id",
66
- "command": "itp buyer checkout create --cart <cart_id> --email <buyer_email> --phone <buyer_phone> --json",
66
+ "command": "itp buyer checkout create --cart <cart_id> --email <buyer_email> --phone <buyer_phone> --host <client> --json",
67
67
  "success_signal": "response.checkout.checkout_id is present; if response.checkout.next_required_action is auth_qr, show response.checkout.human_action and poll/resume until payment_intent_id appears"
68
68
  },
69
69
  {
70
70
  "intent": "do both steps through the high-level command",
71
- "command": "itp buy <variant_id> --email <buyer_email> --phone <buyer_phone> --display agent --no-wait-payment --json",
71
+ "command": "itp buy <variant_id> --email <buyer_email> --phone <buyer_phone> --display agent --no-wait-payment --host <client> --json",
72
72
  "success_signal": "response.status is waiting_human_auth, payment_handoff_required, payment_verified, or delivery_claimable"
73
73
  }
74
74
  ],
@@ -10,33 +10,39 @@
10
10
  "The agent needs to search standardized API products such as ItPay enterprise data APIs."
11
11
  ],
12
12
  "required_state": {
13
- "needs": ["search query or service intent"],
14
- "must_not_need": ["buyer login", "payment intent", "ops token"]
13
+ "needs": [
14
+ "search query or service intent"
15
+ ],
16
+ "must_not_need": [
17
+ "buyer login",
18
+ "payment intent",
19
+ "ops token"
20
+ ]
15
21
  },
16
22
  "commands": [
17
23
  {
18
24
  "intent": "inspect the service shelf before guessing keywords or facets",
19
- "command": "itp buyer shelf manifest --json",
25
+ "command": "itp buyer shelf manifest --host <client> --json",
20
26
  "success_signal": "response.snapshot_version and response.snapshot_url are present; use snapshot/delta when the agent needs a shopping-list view of available services"
21
27
  },
22
28
  {
23
29
  "intent": "search public catalog by natural language query",
24
- "command": "itp buyer catalog search --query \"企业工商信息 查询\" --json",
30
+ "command": "itp buyer catalog search --query \"企业工商信息 查询\" --host <client> --json",
25
31
  "success_signal": "response.products contains services with purchase options, id, title, price, metadata, and response.catalog_guidance explains how to choose safely"
26
32
  },
27
33
  {
28
34
  "intent": "search API services by stable category and safe facets",
29
- "command": "itp buyer catalog search --query \"企业工商信息 查询\" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --delivery-mode managed_capability --use-case company_lookup --input-facet company_name --json",
35
+ "command": "itp buyer catalog search --query \"企业工商信息 查询\" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --delivery-mode managed_capability --use-case company_lookup --input-facet company_name --host <client> --json",
30
36
  "success_signal": "response.products only contains products matching the requested category/facets"
31
37
  },
32
38
  {
33
39
  "intent": "search fuzzy company lookup when the user only provides a partial company name",
34
- "command": "itp buyer catalog search --query \"企业 模糊 查询 公司简称\" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --use-case company_disambiguation --input-facet company_name --json",
40
+ "command": "itp buyer catalog search --query \"企业 模糊 查询 公司简称\" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --use-case company_disambiguation --input-facet company_name --host <client> --json",
35
41
  "success_signal": "response.products includes the fuzzy enterprise search product before precise lookup"
36
42
  },
37
43
  {
38
44
  "intent": "get exact service details for a selected purchase option",
39
- "command": "itp buyer catalog get --variant <variant_id> --json",
45
+ "command": "itp buyer catalog get --variant <variant_id> --host <client> --json",
40
46
  "success_signal": "response.selection.catalog_variant_id matches the selected purchase option and response.catalog_guidance says to explain before cart creation"
41
47
  }
42
48
  ],
@@ -75,5 +81,26 @@
75
81
  "command": "itp docs show cart-checkout --role buyer --json"
76
82
  }
77
83
  ],
78
- "search_terms": ["catalog", "search", "shelf", "product", "variant", "purchase option", "api", "enterprise_data", "category", "facet", "business_data_api", "企业查询", "工商信息", "企业工商数据精准查询", "企业工商数据模糊查询", "搜索", "商品", "服务目录", "目录清单", "购买选项"]
84
+ "search_terms": [
85
+ "catalog",
86
+ "search",
87
+ "shelf",
88
+ "product",
89
+ "variant",
90
+ "purchase option",
91
+ "api",
92
+ "enterprise_data",
93
+ "category",
94
+ "facet",
95
+ "business_data_api",
96
+ "企业查询",
97
+ "工商信息",
98
+ "企业工商数据精准查询",
99
+ "企业工商数据模糊查询",
100
+ "搜索",
101
+ "商品",
102
+ "服务目录",
103
+ "目录清单",
104
+ "购买选项"
105
+ ]
79
106
  }
@@ -10,18 +10,23 @@
10
10
  "The delivery status says claim_link_sent or check_email."
11
11
  ],
12
12
  "required_state": {
13
- "needs": ["delivery status or human email"],
14
- "must_not_need": ["claim token in agent context", "raw content in CLI output"]
13
+ "needs": [
14
+ "delivery status or human email"
15
+ ],
16
+ "must_not_need": [
17
+ "claim token in agent context",
18
+ "raw content in CLI output"
19
+ ]
15
20
  },
16
21
  "commands": [
17
22
  {
18
23
  "intent": "show agent-safe delivery status only",
19
- "command": "itp buyer deliveries list --checkout <checkout_id> --json",
24
+ "command": "itp buyer deliveries list --checkout <checkout_id> --host <client> --json",
20
25
  "success_signal": "response.secrets.raw_content_included == false"
21
26
  },
22
27
  {
23
28
  "intent": "check whether the human has granted this agent a scoped view",
24
- "command": "itp buyer vault grants list --checkout <checkout_id> --json",
29
+ "command": "itp buyer vault grants list --checkout <checkout_id> --host <client> --json",
25
30
  "success_signal": "count > 0 means the human approved agent-readable access for this exact agent device"
26
31
  }
27
32
  ],
@@ -32,7 +37,7 @@
32
37
  "If the human wants the agent to analyze or use the delivered result, ask them to click 'Give to Agent / 一键给 Agent' in the ItPay page and confirm with Passkey.",
33
38
  "Use clear user guidance: open the ItPay email or order/claim page, find 'Give to Agent / 一键给 Agent', select the fields the agent may read, then confirm with Passkey/WebAuthn.",
34
39
  "Tell the user they do not need to copy claim links, tokens, portal text, grant ids, or raw results into chat. The agent will discover the grant with CLI after approval.",
35
- "After the human grants access, the agent should discover the grant with `itp buyer vault grants list --checkout <checkout_id> --json`; do not ask the human to paste the grant id. The CLI restores the buyer agent session from the checkout auth handoff when possible.",
40
+ "After the human grants access, the agent should discover the grant with `itp buyer vault grants list --checkout <checkout_id> --host <client> --json`; do not ask the human to paste the grant id. The CLI restores the buyer agent session from the checkout auth handoff when possible.",
36
41
  "If `buyer vault grants list` returns buyer_session.status=buyer_session_saved, the agent should proceed with the returned grant list; the saved session is intentionally not printed.",
37
42
  "If the human later wants the agent to install or use something, wait for an explicit human-granted install/capability flow."
38
43
  ],
@@ -59,5 +64,14 @@
59
64
  "command": "itp docs show safety-policy --role buyer --json"
60
65
  }
61
66
  ],
62
- "search_terms": ["claim ui", "claim page", "human", "single use", "reveal", "领取页", "人类", "查看密钥"]
67
+ "search_terms": [
68
+ "claim ui",
69
+ "claim page",
70
+ "human",
71
+ "single use",
72
+ "reveal",
73
+ "领取页",
74
+ "人类",
75
+ "查看密钥"
76
+ ]
63
77
  }
@@ -25,29 +25,33 @@
25
25
  "commands": [
26
26
  {
27
27
  "intent": "create payment intent through the high-level buy flow",
28
- "command": "itp buy <variant_id> --email <buyer_email> --phone <buyer_phone> --display agent --no-wait-payment --json",
29
- "success_signal": "response.status is payment_handoff_required; for OpenClaw Telegram, send response.agent_instruction.openclaw_message.command_args with openclaw message send before any status check"
28
+ "command": "itp buy <variant_id> --email <buyer_email> --phone <buyer_phone> --display agent --no-wait-payment --host <client> --json",
29
+ "success_signal": "response.status is payment_handoff_required; for OpenClaw Telegram, execute response.agent_action.command or response.agent_action.argv before any normal reply or status check"
30
30
  },
31
31
  {
32
32
  "intent": "recover a scanner order-not-found display problem",
33
- "command": "itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --display agent --json",
33
+ "command": "itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --display agent --host <client> --json",
34
34
  "success_signal": "response.payment_intent.human_action.local_qr_path or response.payment_intent.qr_png_url is present and status is still waiting_user_payment or verified"
35
35
  }
36
36
  ],
37
37
  "agent_rules": [
38
+ "Every non-doc ItPay command must include current client context. Use --host codex/claude-code/terminal/plain-chat, or for OpenClaw Telegram use --host telegram --target <inbound_meta.chat_id>.",
39
+ "If ItPay returns client_context_required or client_target_required, rerun the same command with the requested --host/--target before doing anything else.",
38
40
  "If human_action.kind is auth_qr, present the ItPay first-purchase entry URL/QR and explain it starts account login/registration/profile authorization and should continue to payment for the same checkout after approval.",
39
41
  "For auth_qr, the ItPay auth entry is the primary handoff. oauth_start_url is fallback/debug and should not replace the ItPay orchestration page.",
40
42
  "For auth_qr, do not call payment-intent creation directly or create a new checkout; poll checkout or run buyer checkout resume until payment_intent_id appears.",
41
43
  "Payment QR display requires both a valid/saved buyer session and payment_intent_id. If payment_intent_id appears before buyer_session is saved, run buyer checkout resume/status instead of showing payment QR.",
42
44
  "Do not stop after showing auth_qr unless the human explicitly asks you to pause. Keep waiting/resuming the same checkout so the post-auth payment handoff can continue.",
43
45
  "Do not describe auth_qr as payment success or payment proof. Only payment_intent.verified proves payment.",
44
- "In OpenClaw Telegram, if response.agent_instruction is present, it is the mandatory execution path. Use response.agent_instruction.openclaw_message.command_args with openclaw message send before any next ItPay command.",
45
- "Do not rewrite response.agent_instruction.openclaw_message into a custom table. Use its message, media, and presentation as provided.",
46
+ "If response.agent_action is present, it is the mandatory execution path. Execute response.agent_action.command or response.agent_action.argv before any normal prose reply or next ItPay command.",
47
+ "In OpenClaw Telegram, response.agent_action is already the exact openclaw message send command. Do not rebuild it, do not summarize it, and do not rewrite it into a custom table.",
48
+ "If response.agent_action cannot be executed, stop and tell the human this agent lacks OpenClaw native message-send capability. Do not fall back to Markdown.",
49
+ "response.agent_instruction is natural-language reinforcement for the agent; it does not replace response.agent_action.",
46
50
  "Telegram native buttons require openclaw message send --presentation; presentation.blocks[].type=\"buttons\" uses native text/url/callback_data. Do not simulate buttons in normal prose.",
47
- "If agent_instruction or human_output links/buttons include URLs, include the real URL. Do not only show the link label.",
48
- "In Codex or Claude Code app clients, send response.human_output.markdown first. Do not start a hidden long wait before the human-visible message is sent.",
51
+ "If agent_instruction links/buttons include URLs, include the real URL. Do not only show the link label.",
52
+ "In Codex or Claude Code app clients, send response.agent_instruction.markdown first. Do not start a hidden long wait before the human-visible message is sent.",
49
53
  "For Telegram-style message clients, send photo media first, include links, and expose native buttons for refresh/status when the adapter supports them.",
50
- "For plain chat clients, show response.human_visible_markdown and stop unless the human asks you to check status or returns with a payment question.",
54
+ "For plain chat clients, show response.agent_instruction.message/links and stop unless the human asks you to check status or returns with a payment question.",
51
55
  "When response.status is payment_handoff_required, response.next is the human reply step, not payment wait.",
52
56
  "MUST show local_qr_path first when present. Many agent clients do not reliably render remote QR images; local_qr_path is the most reliable desktop/chat display artifact.",
53
57
  "If local_qr_path is not present, show qr_png_url or preferred_qr_url as the primary scannable QR. This is an ItPay-hosted human QR image; it may render the native provider payment code for scanner reliability, but the agent must not request or decode the raw provider payload.",
@@ -25,17 +25,18 @@
25
25
  "commands": [
26
26
  {
27
27
  "intent": "wait for payment verified event",
28
- "command": "itp buyer payment wait <payment_intent_id> --timeout 1 --json",
28
+ "command": "itp buyer payment wait <payment_intent_id> --timeout 1 --host <client> --json",
29
29
  "success_signal": "response.payment_event.event_type is payment_intent.verified or wait.timeout"
30
30
  },
31
31
  {
32
32
  "intent": "resume checkout after verified event",
33
- "command": "itp buyer checkout status <checkout_id> --json",
33
+ "command": "itp buyer checkout status <checkout_id> --host <client> --json",
34
34
  "success_signal": "response.delivery.status or response.checkout.status is returned"
35
35
  }
36
36
  ],
37
37
  "agent_rules": [
38
- "If payment wait returns payment_handoff_required with response.agent_instruction, send response.agent_instruction.openclaw_message.command_args before running any later status check.",
38
+ "Every payment wait/status command must include the same client context as the handoff command. For OpenClaw Telegram, keep --host telegram --target <same chat_id>.",
39
+ "If payment wait returns payment_handoff_required with response.agent_action, execute response.agent_action.command or response.agent_action.argv before any later status check. If only response.agent_instruction is present, follow it exactly before any later status check.",
39
40
  "Start payment status checks only after the QR image/link has already been sent to the human or the human asks to check status.",
40
41
  "If you run payment wait without a short timeout while payment is still pending, CLI returns payment_handoff_required and the human handoff instruction instead of long-polling.",
41
42
  "Payment wait/status check is a recovery loop around the same payment_intent_id, not a one-shot command.",
@@ -22,7 +22,7 @@
22
22
  "commands": [
23
23
  {
24
24
  "intent": "refresh exact product detail before recommendation",
25
- "command": "itp buyer catalog get --variant <variant_id> --json",
25
+ "command": "itp buyer catalog get --variant <variant_id> --host <client> --json",
26
26
  "success_signal": "response.product.variants includes current price and availability"
27
27
  }
28
28
  ],
@@ -10,18 +10,24 @@
10
10
  "The payment intent is still not verified."
11
11
  ],
12
12
  "required_state": {
13
- "needs": ["payment_intent_id"],
14
- "must_not_need": ["ops token", "provider query", "new checkout"]
13
+ "needs": [
14
+ "payment_intent_id"
15
+ ],
16
+ "must_not_need": [
17
+ "ops token",
18
+ "provider query",
19
+ "new checkout"
20
+ ]
15
21
  },
16
22
  "commands": [
17
23
  {
18
24
  "intent": "ask ItPay for same-intent display recovery",
19
- "command": "itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --json",
25
+ "command": "itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --host <client> --json",
20
26
  "success_signal": "response.payment_intent.qr_png_url or response.payment_intent.qr_image_url is present"
21
27
  },
22
28
  {
23
29
  "intent": "continue waiting after refresh",
24
- "command": "itp buyer payment wait <payment_intent_id> --timeout 1 --json",
30
+ "command": "itp buyer payment wait <payment_intent_id> --timeout 1 --host <client> --json",
25
31
  "success_signal": "payment_event.event_type == payment_intent.verified"
26
32
  }
27
33
  ],
@@ -50,5 +56,12 @@
50
56
  "command": "itp docs show recovery --role buyer --json"
51
57
  }
52
58
  ],
53
- "search_terms": ["refresh", "order not found", "expired qr", "qr unavailable", "刷新", "订单不存在"]
59
+ "search_terms": [
60
+ "refresh",
61
+ "order not found",
62
+ "expired qr",
63
+ "qr unavailable",
64
+ "刷新",
65
+ "订单不存在"
66
+ ]
54
67
  }