@itpay/cli 2.0.30 → 2.0.32
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 +20 -9
- package/dist/src/client/backend.js +3 -1
- package/dist/src/commands/checkout.js +1 -1
- package/dist/src/commands/guidance.js +11 -412
- package/dist/src/commands/install.js +1 -1
- package/dist/src/commands/order.js +13 -3
- package/dist/src/commands/orders.js +66 -17
- package/dist/src/commands/pay.js +1 -1
- package/dist/src/commands/readyz.js +2 -2
- package/dist/src/commands/refund.js +12 -12
- package/dist/src/commands/services.js +48 -28
- package/dist/src/commands/skill.js +3 -3
- package/dist/src/commands/vault.js +63 -17
- package/dist/src/commands/vault_handoff.js +71 -0
- package/dist/src/main.js +56 -17
- package/dist/src/render/ide.js +1 -1
- package/dist/src/state/config.js +2 -2
- package/docs/agent/buyer/catalog-list.json +11 -8
- package/docs/agent/buyer/install-and-setup.json +15 -13
- package/docs/agent/buyer/orders-refunds.json +34 -7
- package/docs/agent/buyer/payment-flow.json +9 -4
- package/docs/agent/buyer/purchased-content.json +58 -0
- package/docs/agent/buyer/quickstart.json +22 -40
- package/docs/agent/buyer/render-hosts.json +7 -4
- package/docs/cli-reference/agent-types.md +23 -5
- package/docs/cli-reference/commands/checkout.md +3 -1
- package/docs/cli-reference/commands/install.md +3 -1
- package/docs/cli-reference/commands/order.md +2 -2
- package/docs/cli-reference/commands/orders.md +43 -55
- package/docs/cli-reference/commands/pay.md +2 -0
- package/docs/cli-reference/commands/readyz.md +3 -3
- package/docs/cli-reference/commands/refund/create.md +2 -2
- package/docs/cli-reference/commands/refund/get.md +7 -7
- package/docs/cli-reference/commands/refund/index.md +8 -0
- package/docs/cli-reference/commands/refund/watch.md +2 -2
- package/docs/cli-reference/commands/services/action.md +1 -1
- package/docs/cli-reference/commands/services/invoke.md +5 -5
- package/docs/cli-reference/commands/services/list.md +3 -3
- package/docs/cli-reference/commands/services/next.md +7 -5
- package/docs/cli-reference/commands/skill.md +28 -11
- package/docs/cli-reference/commands/vault/access.md +37 -9
- package/docs/cli-reference/commands/vault/index.md +12 -5
- package/docs/cli-reference/commands/vault/list.md +26 -9
- package/docs/cli-reference/commands/vault/read.md +18 -5
- package/docs/cli-reference/conventions.md +27 -0
- package/docs/cli-reference/index.md +2 -2
- package/package.json +2 -2
- package/skills/itpay/SKILL.md +74 -136
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
| Agent Type | 默认 Host | 初始 instruction 差异 |
|
|
12
12
|
|---|---|---|
|
|
13
|
-
| `codex-desktop` | `codex` | 返回可在 Codex
|
|
14
|
-
| `codex-cli` | `terminal` |
|
|
15
|
-
| `claude-code-desktop` | `claude-code` | 返回桌面对话可展示的 Markdown
|
|
16
|
-
| `claude-code-cli` | `terminal` |
|
|
13
|
+
| `codex-desktop` | `codex` | 返回可在 Codex 桌面对话中展示的本地二维码和官方链接,要求 Agent 将 handoff 实际发到当前对话。 |
|
|
14
|
+
| `codex-cli` | `terminal` | 在用户可见终端渲染二维码并输出官方链接;若用户不看该终端,要求使用真实 Host。 |
|
|
15
|
+
| `claude-code-desktop` | `claude-code` | 返回桌面对话可展示的 Markdown 图片和官方链接,要求先展示再等待。 |
|
|
16
|
+
| `claude-code-cli` | `terminal` | 在用户可见终端输出二维码和官方链接,不声称已在桌面对话展示。 |
|
|
17
17
|
| `workbuddy` | `plain-chat` | 返回完整渲染的 HTML Card Link 和可原样执行的 `present_files` action;立即打开 Card Link,不返回或检查本地图片路径。 |
|
|
18
18
|
| `kimi-code` | `terminal` | 使用标准 CLI 引导,在用户可见终端渲染二维码和付款链接。 |
|
|
19
19
|
| `openclaw` | 无;必须显式传入 | `--host telegram` 使用 OpenClaw 原生 `message` action;其他入口返回标准 HTTPS 二维码和付款链接。 |
|
|
@@ -35,7 +35,13 @@
|
|
|
35
35
|
- session 失效时 CLI 只续期并重试原请求一次;再次失败立即返回。revoked v2 Device 不自动换身份。
|
|
36
36
|
- 同一 Device 首次登记新的 Agent Type 时,CLI 只使用本地已登记且 Backend 仍接受的既有 Agent Instance 完成签名登记;被撤销的 Instance 会被跳过且不会恢复。若没有任何既有 Instance 可用,CLI 必须停止,不得重新登记 Device、旋转私钥或借用其他 Backend。
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Human Handoff 最小合同
|
|
39
|
+
|
|
40
|
+
Checkout 与账号读取授权使用相同的 Host 投影规则:`result` 是业务事实,
|
|
41
|
+
`handoff` 是必须交给当前用户的操作入口。完整官方 handoff URL 可以展示;
|
|
42
|
+
URL 内 credential 不得被提取、单独输出、记录或重建。
|
|
43
|
+
|
|
44
|
+
### Checkout
|
|
39
45
|
|
|
40
46
|
```json
|
|
41
47
|
{
|
|
@@ -77,3 +83,15 @@
|
|
|
77
83
|
WorkBuddy instruction 必须要求 Agent 原样执行一次 `handoff.agent_action`,即调用 `present_files(files=[handoff.url])` 在右侧打开 Backend 已渲染的 HTML Card。调用成功后说明金额并停止;调用失败时只发送原始 `handoff.url` 并如实报告未自动打开。禁止把 `present_files` 用于本地文件或二维码 PNG,也不能下载或重建二维码、调用 `pay` 或创建替代付款资源。显式 `--host` 仍覆盖默认展示方式。
|
|
78
84
|
|
|
79
85
|
OpenClaw Telegram 的 `handoff.agent_action` 是可原样执行的原生 `message` tool action。`presentation` 只包含标准 `blocks.buttons`:`📱 手机点这儿支付` 使用扁平 `url`,`📋 已授权给我读` 使用扁平 `value=itp:grant_confirmed:<checkout_id>`;二维码单独使用 action 的 `media`。CLI `instruction` 必须要求 Agent 原样执行该 action,不得改写 Presentation、换用其他消息工具或声称普通文本回复等同于已发送按钮。收到授权 callback 后立即执行 `next.command` 查询同一 Checkout,再只跟随后端返回的同一 Execution grant 流程;callback 只携带 Checkout ID,不携带 display token,也不证明付款或 grant 已生效。OpenClaw `target` 使用原生 chat target(如 `5559456744` 或 `-1001234567890:topic:42`),不添加 `telegram:` 前缀。
|
|
86
|
+
|
|
87
|
+
### Purchased-content authorization
|
|
88
|
+
|
|
89
|
+
`vault access` 使用相同字段集合,但不包含金额、Checkout ID、付款状态或付款
|
|
90
|
+
查询命令。桌面 handoff 的 Markdown 标题和链接必须明确为“授权查看已购
|
|
91
|
+
内容”;Terminal 显示授权二维码;WorkBuddy 用 `present_files` 打开完整
|
|
92
|
+
`handoff.url`;OpenClaw 使用返回的图片/原生 action。
|
|
93
|
+
|
|
94
|
+
授权 handoff 展示后 `next=null`。用户明确表示已完成时,Agent只重新执行
|
|
95
|
+
产生授权要求的原始 `vault list`、`orders` 或 `vault read`,不得再次执行
|
|
96
|
+
`vault access` 检查状态。图片展示失败时保留并发送同一个官方 URL,不创建
|
|
97
|
+
替代请求。
|
|
@@ -41,7 +41,7 @@ itpay checkout [--id <checkout_id>] [--token <display_token>]
|
|
|
41
41
|
{
|
|
42
42
|
"status": "completed",
|
|
43
43
|
"result": { "checkout_id": "<checkout_id>", "payment": "verified", "order_id": "<optional_order_id>", "service_execution_id": "<optional_id>" },
|
|
44
|
-
"instruction": "
|
|
44
|
+
"instruction": "告诉用户:付款已经确认,订单已经记录,不需要再次付款;结果会在同一订单下继续准备,如果最终无法交付,可以从原订单申请退款,处理方式由内容是否已使用决定。然后只执行 next.command 读取同一笔服务;Agent 不再展示付款入口或创建新订单,也不承诺退款结果。",
|
|
45
45
|
"next": { "command": "itpay services next <service_execution_id> --json", "reason": "读取同一笔已付款 Service Execution" },
|
|
46
46
|
"recovery": []
|
|
47
47
|
}
|
|
@@ -49,6 +49,8 @@ itpay checkout [--id <checkout_id>] [--token <display_token>]
|
|
|
49
49
|
|
|
50
50
|
已完成状态不得请求 QR PNG、生成二维码、输出附件指令或建议 `pay`。如果 Checkout 包含一个 Service Execution,下一步读取该 execution;通用订单则读取 `order_id`。`refunded`、`failed`、`expired` 同样不生成 handoff,只返回服务端终态和可用恢复方向。
|
|
51
51
|
|
|
52
|
+
退款说明是用户保障,不是退款承诺。退款资格、自动/人工路径和最终结果仍由原订单的 Refund Owner 根据支付与消费事实决定。
|
|
53
|
+
|
|
52
54
|
## 异常处理
|
|
53
55
|
|
|
54
56
|
token 缺失或不匹配时使用本机句柄恢复。只有请求的 Checkout 正是本机保存的 Service Checkout 时,才返回对应 `services checkout <service_execution_id> --resume --json`;否则返回 `services list`,不能把另一个 execution 的 token 拼上去,也不能跳到 cart 或新建付款。
|
|
@@ -98,7 +98,7 @@ OpenClaw 额外明确没有默认入口:
|
|
|
98
98
|
}
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
|
-
"instruction": "
|
|
101
|
+
"instruction": "识别当前真实运行平台,从 result.agent_types 选择对应 agent_type,并由 Agent 自行运行 itpay install <agent_type> --json;不要让用户运行命令,也不要临时更换 Agent Type。",
|
|
102
102
|
"next": null,
|
|
103
103
|
"recovery": [
|
|
104
104
|
{
|
|
@@ -109,6 +109,8 @@ OpenClaw 额外明确没有默认入口:
|
|
|
109
109
|
}
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
`next` 保持为空,因为 CLI 不能替 Agent 猜测其宿主平台;Agent 必须自行完成这次选择并继续执行,不得把技术选择或命令转交给用户。
|
|
113
|
+
|
|
112
114
|
## Agent Type / Host
|
|
113
115
|
|
|
114
116
|
| Agent Type | 默认 Host | instruction 重点 |
|
|
@@ -36,7 +36,7 @@ CLI 使用 Agent Device Authority。设备完成首次付款绑定后,已登
|
|
|
36
36
|
"access_locked": false,
|
|
37
37
|
"service_execution_id": "<service_execution_id>"
|
|
38
38
|
},
|
|
39
|
-
"instruction": "
|
|
39
|
+
"instruction": "先告诉用户订单已经找到并说明当前交付状态;再根据 delivery_mode 使用对应读取入口。不要从订单摘要猜测受保护内容。",
|
|
40
40
|
"next": {
|
|
41
41
|
"command": "itpay services next <service_execution_id> --json",
|
|
42
42
|
"reason": "读取交付状态"
|
|
@@ -68,7 +68,7 @@ CLI 使用 Agent Device Authority。设备完成首次付款绑定后,已登
|
|
|
68
68
|
"status": "accepted"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
"instruction": "
|
|
71
|
+
"instruction": "告诉用户退款处理中,原交付已按政策冻结。然后读取同一退款的权威状态;Agent 不读取交付、不创建授权或重复申请退款。",
|
|
72
72
|
"next": {
|
|
73
73
|
"command": "itpay refund get <refund_request_id> --json",
|
|
74
74
|
"reason": "读取退款的服务器状态"
|
|
@@ -1,85 +1,73 @@
|
|
|
1
1
|
# `itpay orders`
|
|
2
2
|
|
|
3
|
-
> **Product boundary:** `itpay` is the single public CLI entry point, and `$itpay` is its user-facing Skill invocation. Under that one product entry point, the two top-level commerce actions are `buy` and `sell`: Buyer workflows are available now; Seller workflows will use the same entry point and are not implemented yet.
|
|
4
|
-
|
|
5
3
|
## 范围与意义
|
|
6
4
|
|
|
7
|
-
列出当前
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
**下游:** `order <id>`。
|
|
11
|
-
|
|
12
|
-
## 语法与参数
|
|
5
|
+
列出当前 ItPay 账号的安全订单摘要。网页登录 Buyer Session,或具有有效
|
|
6
|
+
账号读取授权的 Local Device / MCP Connection 都可以使用。它不返回交付
|
|
7
|
+
payload、Checkout、支付凭证或内部 Buyer ID。
|
|
13
8
|
|
|
14
9
|
```bash
|
|
15
|
-
itpay orders [--limit <n>] [--status <status>] [--json]
|
|
10
|
+
itpay orders [--limit <n>] [--status <status>] [--cursor <cursor>] [--host <host>] [--target <target>] [--json]
|
|
16
11
|
```
|
|
17
12
|
|
|
18
13
|
| 参数 | 默认 | 说明 |
|
|
19
|
-
|
|
20
|
-
| `--limit` | `20` |
|
|
21
|
-
| `--status` | 全部 |
|
|
22
|
-
| `--
|
|
23
|
-
|
|
24
|
-
`--
|
|
14
|
+
| --- | ---: | --- |
|
|
15
|
+
| `--limit` | `20` | 最大订单数,必须是 `1..100`。 |
|
|
16
|
+
| `--status` | 全部 | 可选订单状态过滤。 |
|
|
17
|
+
| `--cursor` | 无 | Backend 返回的下一页游标;不得自行构造。 |
|
|
18
|
+
| `--host` | Agent Type 默认值 | 授权缺失时保留当前展示 Host;OpenClaw 必须显式提供。 |
|
|
19
|
+
| `--target` | 无 | OpenClaw 消息 Host 的可信会话目标。 |
|
|
20
|
+
| `--json` | 否 | 输出标准 envelope。 |
|
|
25
21
|
|
|
26
|
-
##
|
|
22
|
+
## Agent/网页登录通用成功输出
|
|
27
23
|
|
|
28
24
|
```json
|
|
29
25
|
{
|
|
30
26
|
"status": "listed",
|
|
31
27
|
"result": {
|
|
32
|
-
"orders": [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
]
|
|
28
|
+
"orders": [{
|
|
29
|
+
"order_code": "<IP-code>",
|
|
30
|
+
"service_title": "<title>",
|
|
31
|
+
"subject_label": "<subject>",
|
|
32
|
+
"amount": "2.00 CNY",
|
|
33
|
+
"paid_at": "<RFC3339>",
|
|
34
|
+
"status": "delivered",
|
|
35
|
+
"vault_artifact_count": 1
|
|
36
|
+
}],
|
|
37
|
+
"next_cursor": null
|
|
41
38
|
},
|
|
42
|
-
"instruction": "
|
|
43
|
-
"next": { "command": "itpay order <order_id> --json", "reason": "读取所选订单" },
|
|
44
|
-
"recovery": []
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
订单列表不得包含 `checkout_id`、订单 items、交付 artifact、Vault ID 或交付 payload。无匹配订单时返回:
|
|
49
|
-
|
|
50
|
-
```json
|
|
51
|
-
{
|
|
52
|
-
"status": "no_orders",
|
|
53
|
-
"result": { "orders": [] },
|
|
54
|
-
"instruction": "当前账号没有符合条件的订单;不要猜测订单 ID。",
|
|
39
|
+
"instruction": "用编号、服务、购买对象、金额、时间、订单号和状态说明结果;不要假设第一笔就是用户要找的订单。",
|
|
55
40
|
"next": null,
|
|
56
|
-
"recovery": [
|
|
57
|
-
{ "command": "itpay services list --json", "reason": "恢复当前 Agent 设备可见的执行" }
|
|
58
|
-
]
|
|
41
|
+
"recovery": []
|
|
59
42
|
}
|
|
60
43
|
```
|
|
61
44
|
|
|
62
|
-
|
|
45
|
+
网页登录路径可保留内部 `order_id` 以支持既有 `order <id>` 读取;Agent
|
|
46
|
+
安全摘要路径只返回 Backend 已批准的 BuyerOrderSummary 字段。CLI 不把两种
|
|
47
|
+
响应错误拼成同一种 DTO。
|
|
63
48
|
|
|
64
|
-
|
|
49
|
+
## Agent 授权缺失
|
|
65
50
|
|
|
66
51
|
```json
|
|
67
52
|
{
|
|
68
|
-
"status": "
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
"status": "human_authorization_required",
|
|
54
|
+
"result": { "intent": "list_purchase_history" },
|
|
55
|
+
"instruction": "需要用户确认一次身份和只读权限;执行 next.command 生成入口。",
|
|
56
|
+
"next": {
|
|
57
|
+
"command": "itpay vault access --json",
|
|
58
|
+
"reason": "创建一次账号读取授权"
|
|
72
59
|
},
|
|
73
|
-
"
|
|
74
|
-
"next": null,
|
|
75
|
-
"recovery": [
|
|
76
|
-
{ "command": "itpay services list --json", "reason": "恢复当前 Agent 设备可见的执行" }
|
|
77
|
-
]
|
|
60
|
+
"recovery": []
|
|
78
61
|
}
|
|
79
62
|
```
|
|
80
63
|
|
|
81
|
-
|
|
64
|
+
用户完成后重新执行原始 `orders` 命令。CLI 不要求 Agent构造或粘贴 Buyer
|
|
65
|
+
token,也不改用 Service Execution 猜测账号历史。
|
|
82
66
|
|
|
83
|
-
|
|
67
|
+
当 `next_cursor` 非空时,`next.command` 使用同一 limit/status 和 Backend 返回的
|
|
68
|
+
cursor 读取下一页。Agent 只在用户需要查看更多订单时执行,不能修改或猜测
|
|
69
|
+
cursor。OpenClaw 的授权下一步必须保留原命令的 `--host` 和所需 `--target`;
|
|
70
|
+
若原命令未提供,CLI 会用明确占位符要求 Agent 从当前可信会话补齐。
|
|
84
71
|
|
|
85
|
-
`
|
|
72
|
+
无匹配订单使用 `status=no_orders`、`orders=[]` 和 `next=null`。无效 limit
|
|
73
|
+
和 status 必须在 HTTP 前返回稳定合同错误。
|
|
@@ -73,6 +73,8 @@ API 安全合同要求后端验证 display token 是该 Checkout 当前有效的
|
|
|
73
73
|
- `failed`、`expired`、`refunded` 返回 `payment_unavailable`,不创建替代 Checkout。
|
|
74
74
|
- 两者都只引导 `checkout --id ... --token ... --json` 读取服务端事实。
|
|
75
75
|
|
|
76
|
+
`payment_verified` 的 instruction 必须先让 Agent 告诉用户付款已经确认、订单已记录且不需要再次付款;交付异常应恢复原订单并按 Refund Owner 的消费事实处理,不承诺自动、无条件或即时退款。Payment Intent 终态不是交付或退款终态,CLI 不据此替用户判断权益。
|
|
77
|
+
|
|
76
78
|
## 重试与刷新
|
|
77
79
|
|
|
78
80
|
- 数据库以 `(checkout_id, payment_method_type)` 作为 Payment Intent 业务唯一键。
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
检查当前官方 Backend 是否可用。默认使用生产环境 `https://app.itpay.ai`;仅测试时可通过 `ITPAY_BACKEND_URL=https://dev.itpay.ai` 选择官方开发环境。它只调用 `/v1/readyz` 做 liveness 诊断,不执行平台兼容性 gate、不登记设备、不创建业务资源;需要服务端合同的命令仍会在各自入口严格检查 compatibility。
|
|
8
8
|
|
|
9
9
|
**上游:** CLI 安装;Backend 只能是官方 `https://app.itpay.ai` 或 `https://dev.itpay.ai`,其他 override 在网络或本地状态写入前被拒绝。
|
|
10
|
-
**下游:** 完整 `itpay` Skill
|
|
10
|
+
**下游:** 完整 `itpay` Skill;由 Agent 根据用户意图选择新服务、已购内容、订单或退款入口。
|
|
11
11
|
|
|
12
12
|
## 语法与参数
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ itpay readyz [--json]
|
|
|
25
25
|
{
|
|
26
26
|
"status": "ready",
|
|
27
27
|
"result": { "backend": "available", "backend_url": "https://app.itpay.ai", "environment": "production" },
|
|
28
|
-
"instruction": "ItPay
|
|
28
|
+
"instruction": "ItPay 可用。先完整读取内置 Skill,再根据用户意图选择新服务、已购内容、订单或退款入口;不要默认开始购买。",
|
|
29
29
|
"next": { "command": "itpay skill show itpay --json", "reason": "加载完整操作与安全规则" },
|
|
30
30
|
"recovery": []
|
|
31
31
|
}
|
|
@@ -37,7 +37,7 @@ itpay readyz [--json]
|
|
|
37
37
|
{
|
|
38
38
|
"status": "ready",
|
|
39
39
|
"result": { "backend": "available", "backend_url": "https://dev.itpay.ai", "environment": "development" },
|
|
40
|
-
"instruction": "ItPay dev
|
|
40
|
+
"instruction": "ItPay dev 可用。先完整读取内置 Skill,再根据用户意图选择新服务、已购内容、订单或退款入口;后续必须执行返回的完整命令并保持同一 dev Backend。",
|
|
41
41
|
"next": { "command": "ITPAY_BACKEND_URL=https://dev.itpay.ai itpay skill show itpay --json", "reason": "加载完整操作与安全规则" },
|
|
42
42
|
"recovery": []
|
|
43
43
|
}
|
|
@@ -39,7 +39,7 @@ CLI 使用 Device Authority 或已有 Buyer bearer,并用订单+原因生成
|
|
|
39
39
|
"access_locked": true,
|
|
40
40
|
"can_cancel": true
|
|
41
41
|
},
|
|
42
|
-
"instruction": "
|
|
42
|
+
"instruction": "先告诉用户退款申请已经记录,原交付已冻结;自动路径表示系统会继续处理,但只有最终 succeeded 才能确认退款成功。然后只跟踪同一退款,不要重复申请、reveal、授权或读取结果。",
|
|
43
43
|
"next": {
|
|
44
44
|
"command": "itpay refund watch <refund_id> --json",
|
|
45
45
|
"reason": "跟踪同一退款"
|
|
@@ -48,7 +48,7 @@ CLI 使用 Device Authority 或已有 Buyer bearer,并用订单+原因生成
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
`decision_mode` 的服务器枚举为 `automatic|manual
|
|
51
|
+
`decision_mode` 的服务器枚举为 `automatic|manual`。未消费交付通常进入 `automatic`;已消费交付通常返回 `manual` / `policy_review_required`。两者只是政策路线:Agent 不得承诺自动路径一定成功、人工审核一定拒绝或具体到账时间。`status` 表示提交动作已完成,`result.refund_status` 才是退款状态机当前状态。
|
|
52
52
|
|
|
53
53
|
若服务器返回退款终态,`next` 为 `null`。文本输出依次显示 result 字段、instruction 和一个 next,不输出支付或 Provider 内部数据。
|
|
54
54
|
|
|
@@ -34,7 +34,7 @@ itpay refund get <refund_request_id> [--json]
|
|
|
34
34
|
"access_locked": true,
|
|
35
35
|
"can_cancel": true
|
|
36
36
|
},
|
|
37
|
-
"instruction": "
|
|
37
|
+
"instruction": "先告诉用户退款申请已经记录,原交付已冻结;自动路径表示系统会继续处理,但只有最终 succeeded 才能确认退款成功。然后只跟踪同一退款,不要重复申请、reveal、授权或读取结果。",
|
|
38
38
|
"next": {
|
|
39
39
|
"command": "itpay refund watch <refund_id> --json",
|
|
40
40
|
"reason": "跟踪同一退款"
|
|
@@ -47,12 +47,12 @@ itpay refund get <refund_request_id> [--json]
|
|
|
47
47
|
|
|
48
48
|
## 终态
|
|
49
49
|
|
|
50
|
-
- `succeeded
|
|
51
|
-
- `cancelled/rejected
|
|
52
|
-
- `failed + known_no_effect
|
|
53
|
-
- `failed + retryable
|
|
54
|
-
- `failed + outcome_unknown
|
|
55
|
-
- `failed + permanent
|
|
50
|
+
- `succeeded`:先告诉用户退款已由 ItPay 确认成功,交付永久关闭,`next=null`。
|
|
51
|
+
- `cancelled/rejected`:说明退款没有执行,交付资格可恢复,但旧 grant 不复活,需要用户重新授权,`next=null`。
|
|
52
|
+
- `failed + known_no_effect`:说明退款请求确认未发送;Agent 不重试,由平台管理员决定是否重新执行,`next=null`。
|
|
53
|
+
- `failed + retryable`:说明渠道明确返回可重试失败但 Agent 不会自行重试;等待平台管理员处理,`next=null`。
|
|
54
|
+
- `failed + outcome_unknown`:说明渠道结果未知、交付继续锁定且必须先对账;禁止重试或重复申请,`next=null`。
|
|
55
|
+
- `failed + permanent`:说明渠道明确拒绝本次退款;停止并联系平台支持,`next=null`。
|
|
56
56
|
|
|
57
57
|
`decision_mode=manual` 只说明该退款采用人工裁定,不得覆盖上述失败终态的 instruction。CLI 永远不向 Agent 暴露 Provider 原始响应、签名、URL、支付标识或内部错误文本。
|
|
58
58
|
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
|
|
22
22
|
退款创建成功即锁定对应交付;旧 Agent grant 不得继续读取。直接运行无参数 `itpay refund` 显示 help,不创建请求。
|
|
23
23
|
|
|
24
|
+
## 用户服务口径
|
|
25
|
+
|
|
26
|
+
- 先说明退款是否已提交、是否冻结交付、当前是自动路径还是人工审核,再给下一步。
|
|
27
|
+
- 未消费交付通常进入自动路径;已消费交付通常进入人工审核。这描述处理路线,不保证成功或到账时间。
|
|
28
|
+
- 只有 `refund_status=succeeded` 才能告诉用户退款成功。
|
|
29
|
+
- `outcome_unknown` 必须解释为需要渠道对账,禁止重复申请或重放。
|
|
30
|
+
- 不向用户倾倒 Provider、签名、网络或内部错误;不得把平台或渠道失败归咎于用户。
|
|
31
|
+
|
|
24
32
|
## 语法、参数与标准输出
|
|
25
33
|
|
|
26
34
|
```bash
|
|
@@ -38,7 +38,7 @@ itpay refund watch <refund_request_id> [--interval <seconds>] [--timeout <second
|
|
|
38
38
|
"access_locked": true,
|
|
39
39
|
"can_cancel": false
|
|
40
40
|
},
|
|
41
|
-
"instruction": "
|
|
41
|
+
"instruction": "先告诉用户退款已由 ItPay 确认成功,原交付永久关闭;不需要继续跟踪或重复申请。",
|
|
42
42
|
"next": null,
|
|
43
43
|
"recovery": []
|
|
44
44
|
}
|
|
@@ -59,7 +59,7 @@ Timeout 只表示本次 CLI 等待结束,不表示退款失败:
|
|
|
59
59
|
"access_locked": true,
|
|
60
60
|
"can_cancel": true
|
|
61
61
|
},
|
|
62
|
-
"instruction": "
|
|
62
|
+
"instruction": "先告诉用户退款仍在处理,Timeout 只表示本次等待结束,并不表示退款失败;稍后继续跟踪同一退款,不要重复申请或承诺结果。",
|
|
63
63
|
"next": {
|
|
64
64
|
"command": "itpay refund watch <refund_id> --json",
|
|
65
65
|
"reason": "恢复轮询"
|
|
@@ -35,7 +35,7 @@ itpay services action <service_execution_id> --action <action_type>
|
|
|
35
35
|
"delivery_email_required": true
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"instruction": "
|
|
38
|
+
"instruction": "已选择 <title>。后续服务尚未购买。只向用户说明继续购买的价格和邮箱用途,请确认是否购买并提供邮箱,然后停止。用户明确同意并提供真实邮箱前,Agent 不执行 next.command,也不创建新的服务或付款页面。",
|
|
39
39
|
"next": { "command": "itpay services checkout <id> --capability <capability_id> --email <email> --json", "reason": "仅在用户明确同意价格并提供真实邮箱后执行" },
|
|
40
40
|
"recovery": [{ "command": "itpay services next <id> --json", "reason": "重新读取服务端允许的动作" }]
|
|
41
41
|
}
|
|
@@ -29,7 +29,7 @@ itpay services invoke <service_execution_id> --capability <capability_id>
|
|
|
29
29
|
"items": [{ "rank": 1, "title": "<title>", "safe_payload": {} }],
|
|
30
30
|
"quota": { "remaining": 2, "limit": 3 }
|
|
31
31
|
},
|
|
32
|
-
"instruction": "
|
|
32
|
+
"instruction": "用编号、名称和可公开字段向用户说明候选;若候选列表已满足目标就停止。只有用户明确选择并希望继续时,才提交对应编号;不要向用户提及 safe_payload、Execution 或内部 ID。",
|
|
33
33
|
"next": { "command": "itpay services action <id> --action <action_type> --actor-type human --status approved --candidate <rank> --json", "reason": "记录用户选择" },
|
|
34
34
|
"recovery": []
|
|
35
35
|
}
|
|
@@ -75,7 +75,7 @@ Provider 已收到请求但没有匹配项时,该 invocation 成功完成、
|
|
|
75
75
|
"delivery_email_required": false
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"instruction": "
|
|
78
|
+
"instruction": "免费额度已用完,本次没有发送到数据来源,也没有创建付款页面。只向用户说明:‘继续当前请求需要支付 0.10 CNY,是否购买?’然后停止等待。用户明确同意前,Agent 不执行 next.command,也不创建或尝试其他购买路径。",
|
|
79
79
|
"next": {
|
|
80
80
|
"command": "itpay services checkout <id> --capability <paid_capability_id> --input <key=value> --json",
|
|
81
81
|
"reason": "仅在用户明确同意支付 0.10 CNY 后执行;否则停止"
|
|
@@ -102,7 +102,7 @@ Provider 已收到请求但没有匹配项时,该 invocation 成功完成、
|
|
|
102
102
|
"provider_called": false,
|
|
103
103
|
"quota": { "remaining": 3, "limit": 3 }
|
|
104
104
|
},
|
|
105
|
-
"instruction": "
|
|
105
|
+
"instruction": "告诉用户本次查询没有发送到数据来源,免费额度已保留,然后停止。不要转述技术错误、自动重试或进入付费路径;只有服务恢复且用户明确要求重新查询后才能开始新的查询。",
|
|
106
106
|
"next": null,
|
|
107
107
|
"recovery": []
|
|
108
108
|
}
|
|
@@ -125,7 +125,7 @@ Provider 已收到请求时,Backend 返回同一 Execution 的权威调用和
|
|
|
125
125
|
"provider_called": true,
|
|
126
126
|
"quota": { "remaining": 0, "limit": 3 }
|
|
127
127
|
},
|
|
128
|
-
"instruction": "
|
|
128
|
+
"instruction": "告诉用户数据来源明确表示当前输入无效,并按 result.quota 说明额度状态,然后停止。不要转述内部错误、自行修改输入、重试或创建新查询;只有用户明确提供新输入后才能重新查询。",
|
|
129
129
|
"next": null,
|
|
130
130
|
"recovery": []
|
|
131
131
|
}
|
|
@@ -142,7 +142,7 @@ Provider 已收到请求时,Backend 返回同一 Execution 的权威调用和
|
|
|
142
142
|
"provider_called": true,
|
|
143
143
|
"quota": { "remaining": 0, "limit": 3 }
|
|
144
144
|
},
|
|
145
|
-
"instruction": "
|
|
145
|
+
"instruction": "告诉用户平台暂时无法正确解释数据来源的响应,这不是用户输入问题,并按 result.quota 说明额度状态。立即停止,不要修改输入、重试、创建新查询或进入付费路径。",
|
|
146
146
|
"next": null,
|
|
147
147
|
"recovery": []
|
|
148
148
|
}
|
|
@@ -32,13 +32,13 @@ itpay services list [--limit <number>] [--json]
|
|
|
32
32
|
{ "service_execution_id": "<id>", "service_id": "<service_id>", "status": "<status>", "phase": "<phase>", "updated_at": "<time>" }
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
|
-
"instruction": "
|
|
36
|
-
"next": { "command": "itpay services next <
|
|
35
|
+
"instruction": "只有一条可恢复记录;继续读取同一笔服务。",
|
|
36
|
+
"next": { "command": "itpay services next <id> --json", "reason": "继续唯一可恢复的服务" },
|
|
37
37
|
"recovery": []
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
不得为每条 execution 附加完整 guidance、capabilities、result items、events、candidate hash、client context 或内部 binding
|
|
41
|
+
不得为每条 execution 附加完整 guidance、capabilities、result items、events、candidate hash、client context 或内部 binding。恰好一条记录时 CLI 返回对应的 `services next`;多条记录时 `next=null`,列表不能把“最新”当成“用户想要”,Agent 必须先用普通语言让用户选择。
|
|
42
42
|
|
|
43
43
|
无结果时返回 `no_executions`、空数组和 `itpay catalog list --json`。
|
|
44
44
|
|
|
@@ -39,7 +39,7 @@ itpay services next <service_execution_id> [--json]
|
|
|
39
39
|
{ "rank": 1, "title": "<title>", "safe_payload": { "<public_field>": "<value>" } }
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
|
-
"instruction": "
|
|
42
|
+
"instruction": "用编号、名称和可公开字段向用户说明候选;若候选列表已满足目标就停止。只有用户明确选择并希望继续时,才提交对应编号;不要向用户提及 safe_payload、Execution 或内部 ID。",
|
|
43
43
|
"next": {
|
|
44
44
|
"command": "itpay services action <id> --action select_candidate --actor-type human --status approved --candidate <rank> --json",
|
|
45
45
|
"reason": "仅在用户明确选择后锁定来源候选"
|
|
@@ -67,7 +67,7 @@ itpay services next <service_execution_id> [--json]
|
|
|
67
67
|
}
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
|
-
"instruction": "
|
|
70
|
+
"instruction": "付费搜索已完成。用编号、名称和可公开字段向用户说明结果,然后停止。只有用户明确选择候选并要求继续时才执行 next.command;不要提及 safe_payload 或自动购买后续报告。",
|
|
71
71
|
"next": {
|
|
72
72
|
"command": "itpay services action <id> --action select_candidate --actor-type human --status approved --candidate <rank> --json",
|
|
73
73
|
"reason": "仅在用户明确选择候选并要求继续时执行"
|
|
@@ -76,7 +76,7 @@ itpay services next <service_execution_id> [--json]
|
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
只有 Graph 允许继续选择时才返回上述 `next
|
|
79
|
+
只有 Graph 允许继续选择时才返回上述 `next`。若结果本身就是最终交付,instruction 要求用普通语言解释可公开字段并停止,且 `next: null`。文本输出可以保留 Agent 执行所需的 Execution 与 `delivery_mode`,但 Agent 不向用户暴露这些内部词、Result Item ID、Invocation ID 或 Hash。
|
|
80
80
|
|
|
81
81
|
## Vault 交付
|
|
82
82
|
|
|
@@ -118,7 +118,7 @@ itpay services next <service_execution_id> [--json]
|
|
|
118
118
|
"failed_nodes": 0
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
-
"instruction": "
|
|
121
|
+
"instruction": "告诉用户:授权已经完成,付费结果仍在同一订单下准备,不需要再次付款或授权。然后只执行 next.command 查询同一笔服务;Agent 不创建新服务、付款页面或数据请求,也不提前读取。",
|
|
122
122
|
"next": {
|
|
123
123
|
"command": "itpay services next <id> --json",
|
|
124
124
|
"reason": "等待同一 Execution 的交付准备完成"
|
|
@@ -127,6 +127,8 @@ itpay services next <service_execution_id> [--json]
|
|
|
127
127
|
}
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
付款确认后仍处于 `wait`/Provider running 时,instruction 必须说明订单和付款已保留、用户不需要再次付款;若 Execution 最终失败,Agent 应恢复同一订单及退款状态,不能自动创建新购买或承诺退款。终态 `failed` 只允许说明本次服务没有正常完成,并读取现有事件用于诊断;不得把技术错误直接归咎于用户。
|
|
131
|
+
|
|
130
132
|
有效 grant 存在时:
|
|
131
133
|
|
|
132
134
|
```json
|
|
@@ -184,7 +186,7 @@ itpay services next <service_execution_id> [--json]
|
|
|
184
186
|
"status": "<refund_status>"
|
|
185
187
|
}
|
|
186
188
|
},
|
|
187
|
-
"instruction": "
|
|
189
|
+
"instruction": "告诉用户退款仍在处理,原交付已按政策冻结。然后读取同一退款的权威状态;Agent 不读取交付、不创建授权或重复申请。",
|
|
188
190
|
"next": {
|
|
189
191
|
"command": "itpay refund get <refund_id> --json",
|
|
190
192
|
"reason": "读取退款权威状态"
|
|
@@ -1,33 +1,50 @@
|
|
|
1
1
|
# `itpay skill` / `itpay skill show`
|
|
2
2
|
|
|
3
|
-
> **Product boundary:** `itpay` is the single public CLI entry point, and `$itpay` is its user-facing Skill invocation. Under that one product entry point, the two top-level commerce actions are `buy` and `sell`: Buyer workflows are available now; Seller workflows will use the same entry point and are not implemented yet.
|
|
4
|
-
|
|
5
3
|
## 范围与意义
|
|
6
4
|
|
|
7
|
-
读取 npm 包内置的完整 ItPay Agent Skill
|
|
5
|
+
读取 npm 包内置的完整 ItPay Agent Skill。Skill 是面向白板 Agent 的精简
|
|
6
|
+
入口:帮助其理解用户意图、选择第一条命令并正确读取后续 CLI envelope。
|
|
7
|
+
完整参数和状态合同由 `itpay docs` 按 topic 渐进提供,不重复塞入 Skill。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
本命令不访问 Backend,不修改宿主配置或本地身份。
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
itpay [--agent-type <agent_type>] skill show itpay [--json]
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
当前只内置 `itpay
|
|
15
|
+
当前只内置 `itpay`。`--json` 时完整 Markdown 位于 `result.content`;文本
|
|
16
|
+
模式直接输出完整内容。
|
|
17
|
+
|
|
18
|
+
## 已声明 Agent Type
|
|
16
19
|
|
|
17
20
|
```json
|
|
18
21
|
{
|
|
19
22
|
"status": "shown",
|
|
20
23
|
"result": { "skill": "itpay", "content": "<complete_packaged_SKILL.md>" },
|
|
21
|
-
"instruction": "
|
|
22
|
-
"next":
|
|
24
|
+
"instruction": "完整读取 Skill,理解当前用户需求,再选择对应的第一条命令;保持当前 Agent Type。",
|
|
25
|
+
"next": null,
|
|
23
26
|
"recovery": []
|
|
24
27
|
}
|
|
25
28
|
```
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
Skill 不能默认把 Agent 引向 Catalog:用户可能要读取以前购买的内容、查看
|
|
31
|
+
订单或处理退款。Agent 必须先完成意图判断。当前命令的 `next` 固定为
|
|
32
|
+
`null`。
|
|
33
|
+
|
|
34
|
+
## 未声明 Agent Type
|
|
35
|
+
|
|
36
|
+
未声明时 instruction 要求先选择真实运行环境,`next` 为:
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"command": "itpay install --json",
|
|
41
|
+
"reason": "选择真实且稳定的 Agent Type"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
30
44
|
|
|
31
|
-
Skill
|
|
45
|
+
未知 Skill 名称返回 `skill_not_found`;包内文件缺失或损坏返回
|
|
46
|
+
`skill_unavailable`。除完整已发布 Skill 内容外,不得附加本地路径、安装
|
|
47
|
+
目录、环境变量、Device 状态或 Backend 数据。
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
`workbuddy` 只在 instruction 中增加既有的本地权限要求;不改变输入、输出
|
|
50
|
+
schema 或意图路由。
|
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
## 语法
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
itpay vault access [--artifact <artifact_ref>] [--json]
|
|
6
|
+
itpay vault access [--artifact <artifact_ref>] [--host <host>] [--target <target>] [--json]
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
- 无 `--artifact`:请求当前 Device + Agent Instance
|
|
10
|
-
- 有 `--artifact
|
|
11
|
-
-
|
|
9
|
+
- 无 `--artifact`:请求当前 Local Device + Agent Instance 的账号读取授权。
|
|
10
|
+
- 有 `--artifact`:请求首次或敏感内容读取授权;必须已有账号授权。
|
|
11
|
+
- `--host` 只选择展示方式,默认由 Agent Type 推导。
|
|
12
|
+
- OpenClaw 必须显式提供当前 `--host`;原生消息 Host 需要 `--target`。
|
|
13
|
+
- CLI 不接受时长、Buyer ID、回调 URL、MCP Connection ID、浏览器 Session
|
|
14
|
+
或 start token 参数。
|
|
12
15
|
|
|
13
16
|
## 标准 JSON
|
|
14
17
|
|
|
@@ -19,14 +22,39 @@ itpay vault access [--artifact <artifact_ref>] [--json]
|
|
|
19
22
|
"request_id": "<id>",
|
|
20
23
|
"purpose": "account_window",
|
|
21
24
|
"artifact_ref": null,
|
|
22
|
-
"request_expires_at": "<RFC3339>"
|
|
23
|
-
"authorization_url": "https://app.itpay.ai/vault/access/...",
|
|
24
|
-
"qr_png_url": "https://app.itpay.ai/v1/vault/access-requests/.../qr.png"
|
|
25
|
+
"request_expires_at": "<RFC3339>"
|
|
25
26
|
},
|
|
26
|
-
"
|
|
27
|
+
"handoff": {
|
|
28
|
+
"url": "https://app.itpay.ai/vault/access/...",
|
|
29
|
+
"qr_local_path": "<desktop-optional-local-path>",
|
|
30
|
+
"markdown": "<desktop-optional-host-ready-markdown>"
|
|
31
|
+
},
|
|
32
|
+
"instruction": "说明这是当前智能体的只读授权,实际展示 handoff,然后停止;用户完成后重新运行最初的读取命令。",
|
|
27
33
|
"next": null,
|
|
28
34
|
"recovery": []
|
|
29
35
|
}
|
|
30
36
|
```
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
完整 `handoff.url` 是 Backend 批准交给当前用户的短期入口。CLI、Skill 和
|
|
39
|
+
Agent不得提取、单独输出、记录或重建其中的 credential;但不得因为 URL
|
|
40
|
+
包含 credential 而拒绝展示完整官方 handoff。
|
|
41
|
+
|
|
42
|
+
同一 pending request 会复用 request ID 并轮换入口 credential,旧链接立即
|
|
43
|
+
失效。因此本命令只能按读取命令返回的 `next` 执行一次,不能用重复执行
|
|
44
|
+
`vault access` 检查状态。
|
|
45
|
+
|
|
46
|
+
## Host handoff
|
|
47
|
+
|
|
48
|
+
| Agent Type / Host | `handoff` keys |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `codex-desktop / codex` | `url, qr_local_path, markdown` |
|
|
51
|
+
| `claude-code-desktop / claude-code` | `url, qr_local_path, markdown` |
|
|
52
|
+
| `codex-cli / terminal` | `url`;文本模式同时渲染终端二维码 |
|
|
53
|
+
| `claude-code-cli / terminal` | `url`;文本模式同时渲染终端二维码 |
|
|
54
|
+
| `workbuddy / plain-chat` | `url, agent_action` |
|
|
55
|
+
| `kimi-code / terminal` | `url`;文本模式同时渲染终端二维码 |
|
|
56
|
+
| `openclaw / telegram` | `url, qr_image_url, agent_action` |
|
|
57
|
+
| `openclaw / other` | `url, qr_image_url` |
|
|
58
|
+
|
|
59
|
+
桌面二维码下载失败时保留 `handoff.url`,instruction 必须要求如实说明图片
|
|
60
|
+
未显示并发送同一个 URL;不得创建替代请求。
|