@itpay/cli 0.2.11 → 0.2.13
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 +27 -21
- package/bin/itp +38 -32
- package/docs/agent/buyer/account-portal.json +22 -6
- package/docs/agent/buyer/cart-checkout.json +9 -9
- package/docs/agent/buyer/catalog-search.json +35 -8
- package/docs/agent/buyer/human-claim-ui.json +20 -6
- package/docs/agent/buyer/payment-qr.json +11 -9
- package/docs/agent/buyer/payment-wait.json +5 -4
- package/docs/agent/buyer/product-recommendation.json +1 -1
- package/docs/agent/buyer/qr-refresh.json +18 -5
- package/docs/agent/buyer/quickstart.json +13 -9
- package/docs/agent/buyer/recovery.json +25 -6
- package/docs/agent/buyer/safety-policy.json +17 -3
- package/docs/agent/buyer/secure-delivery.json +24 -6
- package/docs/agent/buyer/vault-agent-read.json +29 -10
- package/lib/buyer.js +322 -63
- package/lib/client-context.js +126 -0
- package/lib/render-human.js +10 -75
- package/package.json +1 -1
- package/skills/itpay-buyer/SKILL.md +55 -37
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"commands": [
|
|
25
25
|
{
|
|
26
26
|
"intent": "verify whether this agent/device already has a server-valid buyer session",
|
|
27
|
-
"command": "itp status --refresh --json",
|
|
27
|
+
"command": "itp status --refresh --host <client> --json",
|
|
28
28
|
"success_signal": "response.status is idle when authenticated, or response.next.command tells the agent how to start human auth; if response.recoverable_context.found is true, compare it with the current user intent before continuing or ignoring it"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
@@ -34,23 +34,26 @@
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"intent": "search the public catalog for the current user request",
|
|
37
|
-
"command": "itp buyer catalog search --query \"<user request>\" --json",
|
|
37
|
+
"command": "itp buyer catalog search --query \"<user request>\" --host <client> --json",
|
|
38
38
|
"success_signal": "response.products contains public services and purchase options; response.catalog_guidance tells the agent how to compare and when to ask the human"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"intent": "search standardized API services with category/facet filters when intent is clear",
|
|
42
|
-
"command": "itp buyer catalog search --query \"企业工商信息 查询\" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --json",
|
|
42
|
+
"command": "itp buyer catalog search --query \"企业工商信息 查询\" --category business_data_api --provider itpay_enterprise_data --service-type ai_api --host <client> --json",
|
|
43
43
|
"success_signal": "response.products are narrowed by category/facet before recommendation"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"intent": "buy a selected variant with the high-level cart-first flow",
|
|
47
|
-
"command": "itp buy <variant_id> --email <buyer_email> --phone <buyer_phone> --display agent --no-wait-payment --json",
|
|
48
|
-
"success_signal": "response.status becomes waiting_human_auth or payment_handoff_required; if
|
|
47
|
+
"command": "itp buy <variant_id> --email <buyer_email> --phone <buyer_phone> --display agent --no-wait-payment --host <client> --json",
|
|
48
|
+
"success_signal": "response.status becomes waiting_human_auth or payment_handoff_required; in OpenClaw Telegram, if agent_instruction is present, send response.agent_instruction.openclaw_message.command_args before any payment status check"
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
51
|
"agent_rules": [
|
|
52
52
|
"Use --json for every ItPay command.",
|
|
53
|
-
"
|
|
53
|
+
"Every non-doc ItPay command must include the current client context: --host codex, --host claude-code, --host terminal, --host plain-chat, or for OpenClaw/Telegram use --host telegram --target <inbound_meta.chat_id>.",
|
|
54
|
+
"Do not rely on the CLI to guess Telegram, Discord, WhatsApp, Codex, or Claude Code. If ItPay returns client_context_required or client_target_required, rerun the same command with the required --host/--target fields before continuing.",
|
|
55
|
+
"For Telegram group chat or @mention flows, pass the group/private chat target from OpenClaw inbound metadata, for example --target telegram:-1001234567890. ItPay only echoes the target into openclaw message send; OpenClaw owns group allowlist/mention policy.",
|
|
56
|
+
"Use `itp status --refresh --host <client> --json` before account, order, refund, or repeat-purchase decisions. Plain local memory is not identity.",
|
|
54
57
|
"If `status --refresh` returns `recoverable_context.found=true`, do not blindly resume or blindly ignore it. Decide whether the old task is related to the current user intent; continue related tasks, ignore clearly unrelated tasks, and ask the human when unsure.",
|
|
55
58
|
"If the catalog is unclear, read catalog-search docs and use buyer shelf manifest/snapshot as the shopping-list view before guessing keywords.",
|
|
56
59
|
"Search and explain purchase options before buying unless the user already named a purchase option ID.",
|
|
@@ -62,13 +65,14 @@
|
|
|
62
65
|
"After showing auth_qr, keep running/resuming the same checkout unless the human explicitly asks you to pause. Do not stop merely because a QR was displayed.",
|
|
63
66
|
"When a buyer command returns buyer_session.status=buyer_session_saved, the CLI has stored the buyer account session for this agent device. You may continue with checkout/payment or `buyer vault` commands without asking the human for a token.",
|
|
64
67
|
"Vault grants are only for reading approved delivered artifacts. They are not buyer session credentials and do not authorize refunds or account/order management.",
|
|
65
|
-
"Use high-level itp buy when possible, but in agent app clients split payment into two visible steps: first return and send
|
|
66
|
-
"If response.
|
|
68
|
+
"Use high-level itp buy when possible, but in agent app clients split payment into two visible steps: first return and send the human handoff instruction, then only check status after the human responds or uses a platform button.",
|
|
69
|
+
"If response.agent_instruction is present, it is the mandatory execution path for the current client. Do not use fallback fields or handwritten prose instead.",
|
|
70
|
+
"In OpenClaw Telegram, call openclaw message send with response.agent_instruction.openclaw_message.command_args. It includes target, QR media, exact message, and native button presentation.",
|
|
67
71
|
"If response.status is payment_handoff_required, do not run payment wait from next.command; next is the human-visible reply. Only after the human asks to check payment should you run after_human_response.check_payment_command.",
|
|
68
72
|
"Show the returned payment QR exactly as provided before starting payment wait.",
|
|
69
73
|
"Payment truth comes only from payment_intent.verified.",
|
|
70
74
|
"Secure delivery goes to the human first; report redacted delivery status only.",
|
|
71
|
-
"
|
|
75
|
+
"For OpenClaw Telegram, root agent_instruction is the execution path. Do not use handwritten prose when agent_instruction.openclaw_message.command_args is present."
|
|
72
76
|
],
|
|
73
77
|
"forbidden": [
|
|
74
78
|
"Do not call ops commands from the buyer path.",
|
|
@@ -11,23 +11,29 @@
|
|
|
11
11
|
"Checkout or delivery is pending."
|
|
12
12
|
],
|
|
13
13
|
"required_state": {
|
|
14
|
-
"needs": [
|
|
15
|
-
|
|
14
|
+
"needs": [
|
|
15
|
+
"last known checkout_id, payment_intent_id, or variant_id"
|
|
16
|
+
],
|
|
17
|
+
"must_not_need": [
|
|
18
|
+
"ops token",
|
|
19
|
+
"provider raw payload",
|
|
20
|
+
"claim token"
|
|
21
|
+
]
|
|
16
22
|
},
|
|
17
23
|
"commands": [
|
|
18
24
|
{
|
|
19
25
|
"intent": "resume checkout state",
|
|
20
|
-
"command": "itp buyer checkout resume <checkout_id> --json",
|
|
26
|
+
"command": "itp buyer checkout resume <checkout_id> --host <client> --json",
|
|
21
27
|
"success_signal": "response.status and agent_next_actions describe the safe next action"
|
|
22
28
|
},
|
|
23
29
|
{
|
|
24
30
|
"intent": "wait again on the same payment intent",
|
|
25
|
-
"command": "itp buyer payment wait <payment_intent_id> --timeout 1 --json",
|
|
31
|
+
"command": "itp buyer payment wait <payment_intent_id> --timeout 1 --host <client> --json",
|
|
26
32
|
"success_signal": "response.payment_event.event_type is payment_intent.verified or still waiting"
|
|
27
33
|
},
|
|
28
34
|
{
|
|
29
35
|
"intent": "refresh display QR only",
|
|
30
|
-
"command": "itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --json",
|
|
36
|
+
"command": "itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --host <client> --json",
|
|
31
37
|
"success_signal": "response.payment_intent.qr_image_url is present"
|
|
32
38
|
}
|
|
33
39
|
],
|
|
@@ -62,5 +68,18 @@
|
|
|
62
68
|
"command": "itp docs show secure-delivery --role buyer --json"
|
|
63
69
|
}
|
|
64
70
|
],
|
|
65
|
-
"search_terms": [
|
|
71
|
+
"search_terms": [
|
|
72
|
+
"recover",
|
|
73
|
+
"resume",
|
|
74
|
+
"timeout",
|
|
75
|
+
"lost",
|
|
76
|
+
"retry",
|
|
77
|
+
"stuck",
|
|
78
|
+
"恢复",
|
|
79
|
+
"重试",
|
|
80
|
+
"卡住",
|
|
81
|
+
"没返回",
|
|
82
|
+
"断了",
|
|
83
|
+
"找不到"
|
|
84
|
+
]
|
|
66
85
|
}
|
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
"The agent is deciding between buyer and ops commands."
|
|
11
11
|
],
|
|
12
12
|
"required_state": {
|
|
13
|
-
"needs": [
|
|
14
|
-
|
|
13
|
+
"needs": [
|
|
14
|
+
"role=buyer"
|
|
15
|
+
],
|
|
16
|
+
"must_not_need": [
|
|
17
|
+
"ops token",
|
|
18
|
+
"raw secret access"
|
|
19
|
+
]
|
|
15
20
|
},
|
|
16
21
|
"commands": [
|
|
17
22
|
{
|
|
@@ -52,5 +57,14 @@
|
|
|
52
57
|
"command": "itp docs show secure-delivery --role buyer --json"
|
|
53
58
|
}
|
|
54
59
|
],
|
|
55
|
-
"search_terms": [
|
|
60
|
+
"search_terms": [
|
|
61
|
+
"policy",
|
|
62
|
+
"forbidden",
|
|
63
|
+
"security",
|
|
64
|
+
"secret",
|
|
65
|
+
"ops",
|
|
66
|
+
"安全",
|
|
67
|
+
"禁止",
|
|
68
|
+
"权限"
|
|
69
|
+
]
|
|
56
70
|
}
|
|
@@ -10,23 +10,30 @@
|
|
|
10
10
|
"The user asks where the purchased key/content is."
|
|
11
11
|
],
|
|
12
12
|
"required_state": {
|
|
13
|
-
"needs": [
|
|
14
|
-
|
|
13
|
+
"needs": [
|
|
14
|
+
"checkout_id"
|
|
15
|
+
],
|
|
16
|
+
"must_not_need": [
|
|
17
|
+
"claim token",
|
|
18
|
+
"claim link",
|
|
19
|
+
"raw key",
|
|
20
|
+
"storage ref"
|
|
21
|
+
]
|
|
15
22
|
},
|
|
16
23
|
"commands": [
|
|
17
24
|
{
|
|
18
25
|
"intent": "check redacted delivery status",
|
|
19
|
-
"command": "itp buyer checkout status <checkout_id> --json",
|
|
26
|
+
"command": "itp buyer checkout status <checkout_id> --host <client> --json",
|
|
20
27
|
"success_signal": "delivery.sensitive_content_redacted == true"
|
|
21
28
|
},
|
|
22
29
|
{
|
|
23
30
|
"intent": "list agent-safe delivery state",
|
|
24
|
-
"command": "itp buyer deliveries list --checkout <checkout_id> --json",
|
|
31
|
+
"command": "itp buyer deliveries list --checkout <checkout_id> --host <client> --json",
|
|
25
32
|
"success_signal": "response.deliveries contains no raw content or claim token"
|
|
26
33
|
},
|
|
27
34
|
{
|
|
28
35
|
"intent": "after the human says they granted agent access, discover the current agent's grants",
|
|
29
|
-
"command": "itp buyer vault grants list --checkout <checkout_id> --json",
|
|
36
|
+
"command": "itp buyer vault grants list --checkout <checkout_id> --host <client> --json",
|
|
30
37
|
"success_signal": "response.agent_readable_grants contains only grants for this exact agent device"
|
|
31
38
|
}
|
|
32
39
|
],
|
|
@@ -68,5 +75,16 @@
|
|
|
68
75
|
"command": "itp docs show recovery --role buyer --json"
|
|
69
76
|
}
|
|
70
77
|
],
|
|
71
|
-
"search_terms": [
|
|
78
|
+
"search_terms": [
|
|
79
|
+
"delivery",
|
|
80
|
+
"claim",
|
|
81
|
+
"email",
|
|
82
|
+
"key",
|
|
83
|
+
"redeem",
|
|
84
|
+
"secure delivery",
|
|
85
|
+
"交付",
|
|
86
|
+
"邮件",
|
|
87
|
+
"领取",
|
|
88
|
+
"密钥"
|
|
89
|
+
]
|
|
72
90
|
}
|
|
@@ -10,35 +10,45 @@
|
|
|
10
10
|
"A checkout/order has delivered a vault artifact and the human granted agent-readable access."
|
|
11
11
|
],
|
|
12
12
|
"required_state": {
|
|
13
|
-
"needs": [
|
|
14
|
-
|
|
13
|
+
"needs": [
|
|
14
|
+
"checkout_id or authenticated buyer account session",
|
|
15
|
+
"current agent device binding",
|
|
16
|
+
"order_id or checkout_id or vault_artifact_id"
|
|
17
|
+
],
|
|
18
|
+
"must_not_need": [
|
|
19
|
+
"human portal token",
|
|
20
|
+
"claim token",
|
|
21
|
+
"passkey credential",
|
|
22
|
+
"raw protected payload",
|
|
23
|
+
"grant id copied by the human"
|
|
24
|
+
]
|
|
15
25
|
},
|
|
16
26
|
"commands": [
|
|
17
27
|
{
|
|
18
28
|
"intent": "check whether this agent has active human-approved grants for a checkout",
|
|
19
|
-
"command": "itp buyer vault grants list --checkout <checkout_id> --json",
|
|
29
|
+
"command": "itp buyer vault grants list --checkout <checkout_id> --host <client> --json",
|
|
20
30
|
"success_signal": "response.agent_readable_grants is an array; count > 0 means the human has granted this exact agent access"
|
|
21
31
|
},
|
|
22
32
|
{
|
|
23
33
|
"intent": "check whether this agent has active human-approved grants for one order or artifact",
|
|
24
|
-
"command": "itp buyer vault grants list --order <order_id> --artifact <vault_artifact_id> --json",
|
|
34
|
+
"command": "itp buyer vault grants list --order <order_id> --artifact <vault_artifact_id> --host <client> --json",
|
|
25
35
|
"success_signal": "only grants scoped to this logged-in agent device are returned"
|
|
26
36
|
},
|
|
27
37
|
{
|
|
28
38
|
"intent": "read a discovered grant view",
|
|
29
|
-
"command": "itp buyer vault grants read <agent_read_grant_id> --json",
|
|
39
|
+
"command": "itp buyer vault grants read <agent_read_grant_id> --host <client> --json",
|
|
30
40
|
"success_signal": "response.grant contains selected_fields, structured_view, or summary according to the human-approved scope"
|
|
31
41
|
},
|
|
32
42
|
{
|
|
33
43
|
"intent": "convenience read by order/artifact without asking the human for grant id",
|
|
34
|
-
"command": "itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --json",
|
|
44
|
+
"command": "itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --host <client> --json",
|
|
35
45
|
"success_signal": "the CLI discovers the active grant and reads its scoped view"
|
|
36
46
|
}
|
|
37
47
|
],
|
|
38
48
|
"agent_rules": [
|
|
39
49
|
"Only read through `buyer vault` commands after the human has explicitly approved the agent grant in the ItPay portal.",
|
|
40
|
-
"Prefer `itp buyer vault grants list --checkout <checkout_id> --json`; the CLI can automatically restore the buyer agent session from the checkout auth handoff when possible.",
|
|
41
|
-
"If the response includes buyer_session.status=buyer_session_saved, continue directly to `buyer vault grants read <agent_read_grant_id> --json`; do not ask the human for session tokens, auth IDs, or grant IDs.",
|
|
50
|
+
"Prefer `itp buyer vault grants list --checkout <checkout_id> --host <client> --json`; the CLI can automatically restore the buyer agent session from the checkout auth handoff when possible.",
|
|
51
|
+
"If the response includes buyer_session.status=buyer_session_saved, continue directly to `buyer vault grants read <agent_read_grant_id> --host <client> --json`; do not ask the human for session tokens, auth IDs, or grant IDs.",
|
|
42
52
|
"Do not ask the human to copy or paste `agent_read_grant_id`; discover it with `buyer vault grants list`.",
|
|
43
53
|
"If no grant is returned, tell the human to open their ItPay account portal, reveal with Passkey, choose fields, and confirm one-key agent authorization.",
|
|
44
54
|
"If no grant is returned, explain likely causes: the human has not authorized yet, selected the wrong order/page, authorization has not synced yet, checkout/order/artifact does not match, buyer session expired, or the grant expired/revoked.",
|
|
@@ -46,7 +56,7 @@
|
|
|
46
56
|
"Use only fields returned in the grant view. Do not infer that unreturned fields are accessible.",
|
|
47
57
|
"When a grant view is returned, tell the user which fields are readable. If expires_at, ttl, or valid_until is present, tell the user the time limit; if no expiry is returned, say the response did not include an explicit expiry.",
|
|
48
58
|
"If the returned fields are not enough for the user's task, ask the human to reopen Give to Agent and add the needed fields. Do not ask them to paste the missing raw content.",
|
|
49
|
-
"If the command still returns 401 or buyer_session_invalid after using `--checkout`, run `itp buyer checkout status <checkout_id> --json`, then retry `itp buyer vault grants list --checkout <checkout_id> --json`. Ask the human to reauthorize only if the checkout/auth handoff has expired."
|
|
59
|
+
"If the command still returns 401 or buyer_session_invalid after using `--checkout`, run `itp buyer checkout status <checkout_id> --host <client> --json`, then retry `itp buyer vault grants list --checkout <checkout_id> --host <client> --json`. Ask the human to reauthorize only if the checkout/auth handoff has expired."
|
|
50
60
|
],
|
|
51
61
|
"forbidden": [
|
|
52
62
|
"Do not open, click through, scrape, or automate the human web UI yourself.",
|
|
@@ -72,5 +82,14 @@
|
|
|
72
82
|
"command": "itp docs show safety-policy --role buyer --json"
|
|
73
83
|
}
|
|
74
84
|
],
|
|
75
|
-
"search_terms": [
|
|
85
|
+
"search_terms": [
|
|
86
|
+
"vault",
|
|
87
|
+
"agent read",
|
|
88
|
+
"passkey grant",
|
|
89
|
+
"one key agent",
|
|
90
|
+
"授权给 agent",
|
|
91
|
+
"可读授权",
|
|
92
|
+
"字段授权",
|
|
93
|
+
"查看报告"
|
|
94
|
+
]
|
|
76
95
|
}
|