@itpay/cli 2.1.48 → 2.1.49
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 +1 -1
- package/dist/src/main.js +277 -161
- package/dist/src/state/config.js +2 -2
- package/docs/agent/buyer/cart-checkout.json +9 -50
- package/docs/agent/buyer/catalog-list.json +11 -50
- package/docs/agent/buyer/identity-and-sessions.json +9 -81
- package/docs/agent/buyer/install-and-setup.json +7 -47
- package/docs/agent/buyer/orders-refunds.json +9 -81
- package/docs/agent/buyer/payment-flow.json +9 -49
- package/docs/agent/buyer/purchased-content.json +1 -25
- package/docs/agent/buyer/rail-booking.json +25 -152
- package/docs/agent/buyer/render-hosts.json +18 -55
- package/docs/agent/buyer/service-feedback.json +6 -42
- package/docs/cli-reference/agent-types.md +17 -97
- package/docs/cli-reference/commands/auth.md +6 -87
- package/docs/cli-reference/commands/buy.md +23 -168
- package/docs/cli-reference/commands/cart/add.md +3 -1
- package/docs/cli-reference/commands/cart/index.md +2 -2
- package/docs/cli-reference/commands/cart/next.md +2 -0
- package/docs/cli-reference/commands/cart/show.md +2 -22
- package/docs/cli-reference/commands/catalog/index.md +1 -1
- package/docs/cli-reference/commands/catalog/list.md +4 -38
- package/docs/cli-reference/commands/checkout.md +3 -17
- package/docs/cli-reference/commands/device.md +7 -36
- package/docs/cli-reference/commands/docs/list.md +1 -1
- package/docs/cli-reference/commands/docs/show.md +1 -19
- package/docs/cli-reference/commands/feedback/submit.md +5 -17
- package/docs/cli-reference/commands/install.md +3 -39
- package/docs/cli-reference/commands/orders.md +3 -13
- package/docs/cli-reference/commands/pay.md +6 -27
- package/docs/cli-reference/commands/readyz.md +3 -61
- package/docs/cli-reference/commands/refund/cancel.md +1 -21
- package/docs/cli-reference/commands/refund/create.md +4 -28
- package/docs/cli-reference/commands/refund/get.md +3 -3
- package/docs/cli-reference/commands/refund/index.md +3 -3
- package/docs/cli-reference/commands/refund/list.md +1 -14
- package/docs/cli-reference/commands/refund/watch.md +5 -25
- package/docs/cli-reference/commands/services/action.md +6 -35
- package/docs/cli-reference/commands/services/checkout.md +15 -112
- package/docs/cli-reference/commands/services/get.md +4 -39
- package/docs/cli-reference/commands/services/index.md +5 -43
- package/docs/cli-reference/commands/services/invoke.md +6 -147
- package/docs/cli-reference/commands/services/list.md +3 -55
- package/docs/cli-reference/commands/services/next.md +9 -270
- package/docs/cli-reference/commands/services/page.md +4 -37
- package/docs/cli-reference/commands/services/purchase.md +1 -1
- package/docs/cli-reference/commands/services/quote.md +12 -57
- package/docs/cli-reference/commands/services/read-result.md +5 -72
- package/docs/cli-reference/commands/services/run.md +15 -144
- package/docs/cli-reference/commands/services/start.md +7 -49
- package/docs/cli-reference/commands/skill.md +1 -2
- package/docs/cli-reference/commands/vault/access.md +2 -20
- package/docs/cli-reference/commands/vault/list.md +3 -16
- package/docs/cli-reference/commands/vault/read.md +1 -1
- package/docs/cli-reference/conventions.md +2 -2
- package/docs/cli-reference/index.md +1 -1
- package/package.json +2 -4
- package/skills/itpay/SKILL.md +32 -147
- package/docs/agent/buyer/quickstart.json +0 -112
- package/docs/agent/buyer/rail-fast-checkout.json +0 -48
|
@@ -1,157 +1,16 @@
|
|
|
1
1
|
# `itpay services invoke`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## 范围与意义
|
|
6
|
-
|
|
7
|
-
调用当前 phase 允许的非付费 Agent-visible capability。输入先按 capability schema 校验,校验失败不得迁移 execution 或记录 Provider 已调用。
|
|
8
|
-
|
|
9
|
-
**上游:** `services start/next` 明确返回 invoke。
|
|
10
|
-
**下游:** 候选结果、人工 action 或付费 Quote。此页的候选人工选择示例适用于相应的非铁路服务;铁路按 `rail-booking` 的已保存结果和委托选择合同。Provider 错误先按实际错误码和当前 execution 状态恢复,不猜新输入或自动新建。
|
|
11
|
-
|
|
12
|
-
## 语法与参数
|
|
3
|
+
仅在当前执行明确返回 invoke 动作时,调用该合同允许的非付费能力。正常服务使用公开 definition 的 operation 与 `services run`;本页不是另一套查询或购买教程。
|
|
13
4
|
|
|
14
5
|
```bash
|
|
15
6
|
itpay services invoke <service_execution_id> --capability <capability_id>
|
|
16
|
-
[--input <
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
`--input` 可重复;必填 key 来自 `input_schema.required`,值按 schema 类型解析。Agent 不猜字段名。嵌套对象使用已有 JSON 文件读取方式 `--input-json <file>`;文件必须是完整对象,与 `--input` 二选一,冲突或解析失败不会调用供应商。
|
|
20
|
-
|
|
21
|
-
## 有结果输出
|
|
22
|
-
|
|
23
|
-
以下是非铁路候选服务的示例。铁路使用 `services run` 和 `services read-result` 返回的范围、完整紧凑目录与当前动作;不要把这里的 `select_candidate` 人工动作套用到已授权委托的铁路选择。
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"status": "result_ready",
|
|
28
|
-
"result": {
|
|
29
|
-
"service_execution_id": "<id>",
|
|
30
|
-
"capability_id": "<capability_id>",
|
|
31
|
-
"items": [{ "rank": 1, "title": "<title>", "safe_payload": {} }],
|
|
32
|
-
"quota": { "remaining": 2, "limit": 3 }
|
|
33
|
-
},
|
|
34
|
-
"instruction": "用编号、名称和可公开字段向用户说明候选;若候选列表已满足目标就停止。只有用户明确选择并希望继续时,才提交对应编号;不要向用户提及 safe_payload、Execution 或内部 ID。",
|
|
35
|
-
"next": { "command": "itpay services action <id> --action <action_type> --actor-type human --status approved --candidate <rank> --json", "reason": "记录用户选择" },
|
|
36
|
-
"recovery": []
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## 无结果
|
|
41
|
-
|
|
42
|
-
Provider 已收到请求但没有匹配项时,该 invocation 成功完成、提交一次真实额度消费并返回权威剩余额度。CLI 不提供可自动执行的下一步:Agent 必须展示 0 个结果并停止,不得缩短、改写或猜测输入。
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"status": "no_result",
|
|
47
|
-
"result": {
|
|
48
|
-
"service_execution_id": "<id>",
|
|
49
|
-
"capability_id": "company_name_suggestion",
|
|
50
|
-
"query": { "keyword": "北京赢在未来公司" },
|
|
51
|
-
"items": [],
|
|
52
|
-
"quota": { "remaining": 1, "limit": 3 }
|
|
53
|
-
},
|
|
54
|
-
"instruction": "没有找到与“北京赢在未来公司”匹配的结果。向用户展示本次为 0 个结果并停止。不要修改、缩短或猜测其他输入;只有用户明确提供新输入后,才能启动新的查询。",
|
|
55
|
-
"next": null,
|
|
56
|
-
"recovery": []
|
|
57
|
-
}
|
|
7
|
+
[--input-json <file> | --input <key=value> ...] [--json]
|
|
58
8
|
```
|
|
59
9
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## 额度耗尽
|
|
63
|
-
|
|
64
|
-
额度耗尽且需要购买时,支持通用购买的 Execution 返回 `services purchase` 完整确认;未支持的新合同不能猜测授权,已有执行保留原兼容恢复。`services quote -> cart add --quote -> buy --cart` 只用于用户明确要求把多个独立 Execution 合并付款的高级流程。
|
|
65
|
-
|
|
66
|
-
```json
|
|
67
|
-
{
|
|
68
|
-
"status": "quota_exhausted",
|
|
69
|
-
"result": {
|
|
70
|
-
"service_execution_id": "<id>",
|
|
71
|
-
"capability_id": "<capability_id>",
|
|
72
|
-
"items": [],
|
|
73
|
-
"quota": { "remaining": 0, "limit": 3 },
|
|
74
|
-
"checkout": {
|
|
75
|
-
"capability_id": "<paid_capability_id>",
|
|
76
|
-
"price": { "amount_minor": 10, "currency": "CNY" },
|
|
77
|
-
"delivery_email_required": false
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"instruction": "免费额度已用完,本次没有发送到数据来源,也没有创建付款页面。只向用户说明:‘继续当前请求需要支付 0.10 CNY,是否购买?’然后停止等待。用户明确同意前,Agent 不执行 next.command,也不创建或尝试其他购买路径。",
|
|
81
|
-
"next": {
|
|
82
|
-
"command": "itpay services checkout <id> --capability <paid_capability_id> --input <key=value> --json",
|
|
83
|
-
"reason": "仅在用户明确同意支付 0.10 CNY 后执行;否则停止"
|
|
84
|
-
},
|
|
85
|
-
"recovery": []
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
缺少 required input 时返回 `capability_input_invalid`,recovery 给出带占位符的同一 invoke 命令;CLI 和 Backend 都必须在 Provider 调用前拒绝,Backend 还必须在 execution/event/quota/invocation 写入前拒绝。错误调用付费 capability 时不得给出购买旁路,只能回到同一 Execution 的 `services next`;execution 状态、event、ProviderCalled 均保持不变。
|
|
90
|
-
|
|
91
|
-
## Provider 请求前连接失败
|
|
92
|
-
|
|
93
|
-
如果 Backend 能确认请求未发出,返回固定的终态错误,不暴露 DNS、IP、Provider URL 或凭证诊断:
|
|
94
|
-
|
|
95
|
-
```json
|
|
96
|
-
{
|
|
97
|
-
"status": "error",
|
|
98
|
-
"error": {
|
|
99
|
-
"code": "provider_connection_unavailable",
|
|
100
|
-
"message": "provider request was not sent; reserved quota was released"
|
|
101
|
-
},
|
|
102
|
-
"result": {
|
|
103
|
-
"service_execution_id": "<id>",
|
|
104
|
-
"provider_called": false,
|
|
105
|
-
"quota": { "remaining": 3, "limit": 3 }
|
|
106
|
-
},
|
|
107
|
-
"instruction": "告诉用户本次查询没有发送到数据来源,免费额度已保留,然后停止。不要转述技术错误、自动重试或进入付费路径;只有服务恢复且用户明确要求重新查询后才能开始新的查询。",
|
|
108
|
-
"next": null,
|
|
109
|
-
"recovery": []
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
`result.quota` 是释放预留后的权威余额,不是请求前预留时的临时值。该终态不允许 CLI 猜测网络修复、重复 invoke 或转入购买。连接恢复后也不能复用失败 Execution;必须同时满足“运营已确认恢复”和“用户明确要求再次查询”,才创建新 Execution。
|
|
114
|
-
|
|
115
|
-
## Provider 输入、临时和契约错误
|
|
116
|
-
|
|
117
|
-
Provider 已收到请求时,Backend 返回同一 Execution 的权威调用和额度事实。CLI 不读取 raw payload,也不自行推断错误种类。
|
|
118
|
-
|
|
119
|
-
明确输入错误:
|
|
120
|
-
|
|
121
|
-
```json
|
|
122
|
-
{
|
|
123
|
-
"status": "error",
|
|
124
|
-
"error": { "code": "provider_input_rejected", "message": "输入的名称不合法" },
|
|
125
|
-
"result": {
|
|
126
|
-
"service_execution_id": "<id>",
|
|
127
|
-
"provider_called": true,
|
|
128
|
-
"quota": { "remaining": 0, "limit": 3 }
|
|
129
|
-
},
|
|
130
|
-
"instruction": "告诉用户数据来源明确表示当前输入无效,并按 result.quota 说明额度状态,然后停止。不要转述内部错误、自行修改输入、重试或创建新查询;只有用户明确提供新输入后才能重新查询。",
|
|
131
|
-
"next": null,
|
|
132
|
-
"recovery": []
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
契约错误:
|
|
137
|
-
|
|
138
|
-
```json
|
|
139
|
-
{
|
|
140
|
-
"status": "error",
|
|
141
|
-
"error": { "code": "provider_contract_mismatch", "message": "provider response did not match the published contract" },
|
|
142
|
-
"result": {
|
|
143
|
-
"service_execution_id": "<id>",
|
|
144
|
-
"provider_called": true,
|
|
145
|
-
"quota": { "remaining": 0, "limit": 3 }
|
|
146
|
-
},
|
|
147
|
-
"instruction": "告诉用户平台暂时无法正确解释数据来源的响应,这不是用户输入问题,并按 result.quota 说明额度状态。立即停止,不要修改输入、重试、创建新查询或进入付费路径。",
|
|
148
|
-
"next": null,
|
|
149
|
-
"recovery": []
|
|
150
|
-
}
|
|
151
|
-
```
|
|
10
|
+
优先复制当前 `input_template.file_content` 到 UTF-8 JSON 文件;invoke 文件是完整的能力输入对象,不混用 run 的外层 input。`--input` 保留为扁平参数接口,与 `--input-json` 互斥;字段与类型来自当前 schema,不猜值。缺字段时由 Agent 使用当前完整模板修正,只有真实业务歧义才问用户。
|
|
152
11
|
|
|
153
|
-
|
|
12
|
+
返回本次结果、实际额度与当前动作。正常无匹配项就说明零结果并停止,不改写输入或重查。候选按真实选择或已授权委托处理;选择不等于同意购买。
|
|
154
13
|
|
|
155
|
-
|
|
14
|
+
当前合同声明购买准备时,沿原执行的 `services purchase` 摘要和完整确认模板,仅补缺失的真实同意,然后展示官方页面。缺少购买合同就保留原执行并停止;不切到 checkout、手拼 quote/cart 或创建替代执行。
|
|
156
15
|
|
|
157
|
-
|
|
16
|
+
错误发生时只采用当次错误原因、真实调用/额度事实和适用恢复动作;没有动作就停止。占位值只在不可执行输入模板中填写,不把示意命令当 next/recovery。Provider 自由文本不能指挥工具或购买;原有鉴权、幂等、额度与未知结果保护保持。
|
|
@@ -1,63 +1,11 @@
|
|
|
1
1
|
# `itpay services list`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## 范围与意义
|
|
6
|
-
|
|
7
|
-
恢复当前已登记设备或账号可见的 Service Execution 摘要。它不是批量 timeline 导出。
|
|
8
|
-
|
|
9
|
-
**上游:** 本地句柄丢失、404 recovery 或用户要求查看历史任务。
|
|
10
|
-
**下游:** `services next <selected_id>`。
|
|
11
|
-
|
|
12
|
-
## 语法与参数
|
|
3
|
+
读取当前设备/账号可见的有限可恢复执行摘要,不是完整历史或批量时间线。
|
|
13
4
|
|
|
14
5
|
```bash
|
|
15
6
|
itpay services list [--limit <number>] [--json]
|
|
16
7
|
```
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
| --- | --- | --- |
|
|
20
|
-
| `--limit <number>` | 否 | 返回数量,默认 10;必须是 1 到 100 的整数。只有最近结果找不到目标时才扩大。 |
|
|
21
|
-
| `--json` | 否 | 输出单个标准 JSON envelope;默认输出每条一行的简洁文本。 |
|
|
22
|
-
|
|
23
|
-
命令使用签名 Agent Device session。Backend 按 `updated_at DESC` 返回当前设备或已绑定 Buyer account 可见的执行;CLI 保留该顺序,不在本地推断归属。
|
|
24
|
-
|
|
25
|
-
## 标准输出
|
|
26
|
-
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
"status": "listed",
|
|
30
|
-
"result": {
|
|
31
|
-
"executions": [
|
|
32
|
-
{ "service_execution_id": "<id>", "service_id": "<service_id>", "status": "<status>", "phase": "<phase>", "updated_at": "<time>" }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
"instruction": "只有一条可恢复记录;继续读取同一笔服务。",
|
|
36
|
-
"next": { "command": "itpay services next <id> --json", "reason": "继续唯一可恢复的服务" },
|
|
37
|
-
"recovery": []
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
不得为每条 execution 附加完整 guidance、capabilities、result items、events、candidate hash、client context 或内部 binding。恰好一条记录时 CLI 返回对应的 `services next`;多条记录时 `next=null`,列表不能把“最新”当成“用户想要”,Agent 必须先用普通语言让用户选择。
|
|
42
|
-
|
|
43
|
-
无结果时返回 `no_executions`、空数组和 `itpay catalog list --json`。
|
|
44
|
-
|
|
45
|
-
非法 limit 在请求 Backend 前返回:
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"status": "error",
|
|
50
|
-
"error": { "code": "limit_invalid", "message": "--limit must be an integer from 1 to 100" },
|
|
51
|
-
"instruction": "使用 1 到 100 的整数 limit;本次未读取服务端列表。",
|
|
52
|
-
"next": null,
|
|
53
|
-
"recovery": [
|
|
54
|
-
{ "command": "itpay services list --limit 10 --json", "reason": "使用默认上限重试" }
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
身份或 Backend 错误保留服务端错误码,只建议 `readyz` 和重新读取列表;不得猜测 ID。
|
|
60
|
-
|
|
61
|
-
## Agent Type / Host
|
|
9
|
+
`--limit` 默认10,范围1–100整数。结果保留服务端 updated_at 降序,返回 executions、limit、returned_count、scope 和 completeness=unknown;每项附当前 reader。文本和 JSON 表达相同事实,不返回凭据或完整内部DTO。
|
|
62
10
|
|
|
63
|
-
|
|
11
|
+
`next=null`:一条记录不能证明唯一任务,空列表不能证明超时创建未发生。按原任务已知ID或权威关联选 reader;没有关联就停止,不自动选最新、不自动重发或新建。参数由 Agent 修正;认证、兼容和外部故障采用当次专门说明,不把 readyz 或重装当业务恢复。
|
|
@@ -1,278 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# itpay services next
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## 范围与意义
|
|
6
|
-
|
|
7
|
-
读取一笔 Service Execution 的当前状态,并只返回一个首选下一步。若交付模式允许 Agent 直接读取,本命令同时返回完整 safe result。
|
|
8
|
-
|
|
9
|
-
**上游:** `services start`、`invoke`、`action`、`checkout`,或一次中断恢复。
|
|
10
|
-
**下游:** 一个可执行命令、需要用户完成的候选选择或授权,或 Arazzo workflow 真正到达终态。
|
|
11
|
-
|
|
12
|
-
本命令不返回原始 Backend DTO、capability 列表、内部 result ID/hash、Arazzo workflow、binding 或重复 guidance。
|
|
13
|
-
|
|
14
|
-
Backend 会根据当前 capability 选择 `current_delivery`;完整 `delivery_bindings` 仅是历史记录。CLI 不按数组位置猜测当前交付,同一 Execution 后续产生的新交付会取代旧交付成为默认结果。
|
|
15
|
-
|
|
16
|
-
## 语法与参数
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
itpay services next <service_execution_id> [--timeout <seconds>] [--since-snapshot <snapshot_id>] [--json]
|
|
3
|
+
```sh
|
|
4
|
+
itpay services next <execution_id> --timeout 60 --json
|
|
20
5
|
```
|
|
21
6
|
|
|
22
|
-
|
|
23
|
-
| --- | --- | --- |
|
|
24
|
-
| `service_execution_id` | 是 | `services start` 或后续命令返回的 execution ID。 |
|
|
25
|
-
| `--timeout <seconds>` | 否 | 同一执行上的有界只读等待,0–120 秒,默认 0;查询等待中的推荐命令使用 120。已有业务结果、真实用户动作或终态会提前返回。 |
|
|
26
|
-
| `--since-snapshot <snapshot_id>` | 否 | rail.progressive.v2 增量读:传上次看到的 `snapshot_id`,未变化时只回扩展状态与 `result_not_updated`,不重复下发 journey 负载;永远不触发供应商调用。 |
|
|
27
|
-
| `--json` | 否 | 输出稳定 JSON 信封;未指定时输出相同事实的简洁文本。 |
|
|
28
|
-
|
|
29
|
-
需要有效 Agent Device session。命令不接受 Buyer token、capability 或服务输入。
|
|
7
|
+
读取同一执行及其当前适用动作。--timeout 为0–120秒,默认0;已有有用结果、真人操作或终态会提前返回。跨命令累计自动等待最多120秒,耗尽时 next=null,recovery仅在用户明确要求时执行。仍处理中不是零结果。
|
|
30
8
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
免费或付费候选已经产生、Arazzo workflow 允许继续选择时,恢复输出必须包含当前 Result Set 的安全候选:
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"status": "candidate_selection_available",
|
|
38
|
-
"result": {
|
|
39
|
-
"service_execution_id": "<id>",
|
|
40
|
-
"items": [
|
|
41
|
-
{ "rank": 1, "title": "<title>", "safe_payload": { "<public_field>": "<value>" } }
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
"instruction": "用编号、名称和可公开字段向用户说明候选;若候选列表已满足目标就停止。只有用户明确选择并希望继续时,才提交对应编号;不要向用户提及 safe_payload、Execution 或内部 ID。",
|
|
45
|
-
"next": {
|
|
46
|
-
"command": "itpay services action <id> --action select_candidate --actor-type human --status approved --candidate <rank> --json",
|
|
47
|
-
"reason": "仅在用户明确选择后锁定来源候选"
|
|
48
|
-
},
|
|
49
|
-
"recovery": []
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
该列表来自 Backend 的 `current_result_items`,CLI 不缓存或合并其他 Execution 的候选。铁路 Exact 的正常返回改走 `read-result` 已保存车次行及逐行 `detail.command`;Smart 的委托选票用 `select_delegated`(actor-type agent),只有用户亲自选定才用 `select_user_chosen`(actor-type human)。
|
|
54
|
-
|
|
55
|
-
## 非铁路服务的 Agent-visible 结果
|
|
56
|
-
|
|
57
|
-
```json
|
|
58
|
-
{
|
|
59
|
-
"status": "result_ready",
|
|
60
|
-
"result": {
|
|
61
|
-
"service_execution_id": "<id>",
|
|
62
|
-
"capability_id": "<capability_id>",
|
|
63
|
-
"delivery_mode": "agent_visible_result",
|
|
64
|
-
"items": [
|
|
65
|
-
{
|
|
66
|
-
"rank": 1,
|
|
67
|
-
"title": "<title>",
|
|
68
|
-
"safe_payload": { "<public_field>": "<value>" }
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
"instruction": "付费搜索已完成。用编号、名称和可公开字段向用户说明结果,然后停止。只有用户明确选择候选并要求继续时才执行 next.command;不要提及 safe_payload 或自动购买后续报告。",
|
|
73
|
-
"next": {
|
|
74
|
-
"command": "itpay services action <id> --action select_candidate --actor-type human --status approved --candidate <rank> --json",
|
|
75
|
-
"reason": "仅在用户明确选择候选并要求继续时执行"
|
|
76
|
-
},
|
|
77
|
-
"recovery": []
|
|
78
|
-
}
|
|
79
|
-
```
|
|
9
|
+
结果目录/详情/分页及购买输入由当次返回直接给出。照完整模板读写,不手写解析器、不重查、不串联旧下单命令。查询和购买同意遵循正式 Skill 与 rail-booking。
|
|
80
10
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
## Vault 交付
|
|
84
|
-
|
|
85
|
-
未授权时不返回 result item 或 protected payload:
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"status": "human_authorization_required",
|
|
90
|
-
"result": {
|
|
91
|
-
"service_execution_id": "<id>",
|
|
92
|
-
"capability_id": "<capability_id>",
|
|
93
|
-
"delivery_mode": "vault_artifact",
|
|
94
|
-
"grant_status": "none"
|
|
95
|
-
},
|
|
96
|
-
"instruction": "这是当前 Arazzo step 对应的交付;请用户在订单页面授权,未授权前不要读取或猜测内容。",
|
|
97
|
-
"next": {
|
|
98
|
-
"command": "itpay services read-result <id> --json",
|
|
99
|
-
"reason": "仅在用户确认授权后执行"
|
|
100
|
-
},
|
|
101
|
-
"recovery": []
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
用户已经授权、但服务端仍在按已发布执行图准备 Vault 交付时,必须只轮询同一 Execution:
|
|
106
|
-
|
|
107
|
-
```json
|
|
108
|
-
{
|
|
109
|
-
"status": "result_preparing",
|
|
110
|
-
"result": {
|
|
111
|
-
"service_execution_id": "<id>",
|
|
112
|
-
"capability_id": "<capability_id>",
|
|
113
|
-
"delivery_mode": "vault_artifact",
|
|
114
|
-
"grant_status": "pending",
|
|
115
|
-
"preparation": {
|
|
116
|
-
"status": "running",
|
|
117
|
-
"total_nodes": 4,
|
|
118
|
-
"completed_nodes": 2,
|
|
119
|
-
"succeeded_nodes": 2,
|
|
120
|
-
"failed_nodes": 0
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"instruction": "告诉用户:授权已经完成,付费结果仍在同一订单下准备,不需要再次付款或授权。然后只执行 next.command 查询同一笔服务;Agent 不创建新服务、付款页面或数据请求,也不提前读取。",
|
|
124
|
-
"next": {
|
|
125
|
-
"command": "itpay services next <id> --json",
|
|
126
|
-
"reason": "等待同一 Execution 的交付准备完成"
|
|
127
|
-
},
|
|
128
|
-
"recovery": []
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
付款确认后仍处于 `wait`/Provider running 时,instruction 必须说明订单和付款已保留、用户不需要再次付款;若 Execution 最终失败,Agent 应恢复同一订单及退款状态,不能自动创建新购买或承诺退款。终态 `failed` 只允许说明本次服务没有正常完成,并读取现有事件用于诊断;不得把技术错误直接归咎于用户。
|
|
133
|
-
|
|
134
|
-
有效 grant 存在时:
|
|
135
|
-
|
|
136
|
-
```json
|
|
137
|
-
{
|
|
138
|
-
"status": "grant_active",
|
|
139
|
-
"result": {
|
|
140
|
-
"service_execution_id": "<id>",
|
|
141
|
-
"capability_id": "<capability_id>",
|
|
142
|
-
"delivery_mode": "vault_artifact",
|
|
143
|
-
"grant_status": "active",
|
|
144
|
-
"grant_expires_at": "<RFC3339 time>"
|
|
145
|
-
},
|
|
146
|
-
"instruction": "这是当前 Arazzo step 对应的交付;用户授权有效,立即读取并遵守字段范围与到期时间。",
|
|
147
|
-
"next": {
|
|
148
|
-
"command": "itpay services read-result <id> --json",
|
|
149
|
-
"reason": "读取当前有效 grant 的结果"
|
|
150
|
-
},
|
|
151
|
-
"recovery": []
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
额度耗尽或候选已确认并进入付费 continuation 时,`services next` 必须重复价格、用户确认原话、停止条件和禁止动作;普通单 Execution 的 next 使用 `services checkout`,不暴露 Quote/Cart/Buy 编排。
|
|
156
|
-
|
|
157
|
-
已有 Checkout 时,Backend 返回 `resume_checkout`,CLI 只能恢复同一 Checkout:
|
|
158
|
-
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"status": "checkout_pending",
|
|
162
|
-
"result": {
|
|
163
|
-
"service_execution_id": "<id>",
|
|
164
|
-
"service_id": "<service_id>",
|
|
165
|
-
"phase": "checkout",
|
|
166
|
-
"allowed_actions": [{ "type": "resume_checkout", "requires_human": true }]
|
|
167
|
-
},
|
|
168
|
-
"instruction": "当前 Execution 已经有一笔 Checkout。不要创建新的 Quote、Cart、Checkout 或 Execution。现在只执行 next.command,恢复并展示同一 Checkout 的付款入口。",
|
|
169
|
-
"next": { "command": "itpay services checkout <id> --resume --json", "reason": "恢复同一 Checkout,不创建第二笔" },
|
|
170
|
-
"recovery": []
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
付款已确认但 Provider 尚在履约时只能等待并再次读取同一 Execution;不得新建 Execution、Checkout 或再次付款。其他执行阶段只返回 Execution、service、phase、类型化 `allowed_actions` 和一个服务端状态导出的命令。CLI 只把 Backend 的动作类型渲染成命令,不执行 Publication 中的任意 shell 文本。完成或空结果后不得建议重放已失效的 invoke。
|
|
175
|
-
|
|
176
|
-
## 退款访问锁
|
|
177
|
-
|
|
178
|
-
订单存在 active 或永久退款锁时,该状态优先于 Agent-visible、Vault 和 grant guidance,不返回交付结果,也不再要求用户授权:
|
|
179
|
-
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"status": "delivery_locked",
|
|
183
|
-
"result": {
|
|
184
|
-
"service_execution_id": "<id>",
|
|
185
|
-
"access_locked": true,
|
|
186
|
-
"refund": {
|
|
187
|
-
"refund_request_id": "<refund_id>",
|
|
188
|
-
"status": "<refund_status>"
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"instruction": "告诉用户退款仍在处理,原交付已按政策冻结。然后读取同一退款的权威状态;Agent 不读取交付、不创建授权或重复申请。",
|
|
192
|
-
"next": {
|
|
193
|
-
"command": "itpay refund get <refund_id> --json",
|
|
194
|
-
"reason": "读取退款权威状态"
|
|
195
|
-
},
|
|
196
|
-
"recovery": []
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
`succeeded` 退款改为“交付永久关闭”,并返回 `next: null`。取消、拒绝或确定未产生资金影响的失败退款不再阻塞,但旧 grant 不会复活;是否需要新的交付授权由当前 owner 状态与返回动作决定。
|
|
201
|
-
|
|
202
|
-
## 额度暂停(试用/限流)
|
|
203
|
-
|
|
204
|
-
查询 Execution 因免费试用耗尽或限流被暂停时,状态为 `login_required` 或 `rate_limited`(不是 `failed`)。Execution 保留输入,可用同一 `services run <service> --execution <id> --json` 恢复——登录后或限流窗口过后从额度节点继续,不重放已完成阶段,不要新建 Execution 或重述行程。
|
|
205
|
-
|
|
206
|
-
```json
|
|
207
|
-
{
|
|
208
|
-
"status": "login_required",
|
|
209
|
-
"result": {
|
|
210
|
-
"service_execution_id": "<id>",
|
|
211
|
-
"service_id": "itpay-rail-exact",
|
|
212
|
-
"admission": "login_required",
|
|
213
|
-
"query_quota": [
|
|
214
|
-
{ "service_id": "itpay-rail-exact", "used": 2, "limit": 2, "remaining": 0 },
|
|
215
|
-
{ "service_id": "itpay-rail-smart", "used": 0, "limit": 2, "remaining": 2 }
|
|
216
|
-
]
|
|
217
|
-
},
|
|
218
|
-
"instruction": "如实告知该服务的免费试用次数与剩余;请用户登录后继续,原查询无需重新输入。",
|
|
219
|
-
"next": { "command": "itpay auth login --json", "reason": "官方登录绑定后继续免费查询" },
|
|
220
|
-
"recovery": [
|
|
221
|
-
{ "command": "itpay services run itpay-rail-exact --execution <id> --json", "when": "auth_bound" }
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
`rate_limited` 只等待 `retry_after_ms` 后恢复同一执行;不需要登录、不扣试用。
|
|
227
|
-
|
|
228
|
-
## 查询结果中的购买承接
|
|
229
|
-
|
|
230
|
-
铁路查询结果项可携带服务端签发的购票承接 `booking_offer`:
|
|
231
|
-
|
|
232
|
-
```json
|
|
233
|
-
{
|
|
234
|
-
"rank": 1,
|
|
235
|
-
"title": "C6908 二等座 11:48→12:20",
|
|
236
|
-
"safe_payload": { "...": "..." },
|
|
237
|
-
"booking_offer": {
|
|
238
|
-
"service_id": "itpay-rail-booking",
|
|
239
|
-
"selection_token": "sel_...",
|
|
240
|
-
"expires_at": "2026-09-20T04:00:00Z"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
有购买委托时,读取所选完整行程详情,使用其返回的 `itpay-rail --operation prepare_purchase` 完整模板;保留 continuation 的原 execution/snapshot 与完整 selections。上面的 booking_offer 是历史兼容事实,不将它改造成新公共承接或手拼多腿。
|
|
246
|
-
|
|
247
|
-
## 整程订票确认与价格批准
|
|
248
|
-
|
|
249
|
-
当前 `booking_review_required` 返回完整整程 review、每段席别代码/名称、人数、偏好词表、notice_version 与 draft_revision。直接读写返回的完整 JSON,不需要解析脚本;模板的 accept_non_guaranteed 默认 false。只补用户尚未明确同意的实质内容;仅修席别代码而车次、实际席别、人数、价格、条款未变时沿用原真实确认。
|
|
250
|
-
|
|
251
|
-
- 每段保留相连行程、对应席别、每位乘客偏好;不要恢复固定单腿 scalar 模板。
|
|
252
|
-
- `booking_review_changed` 重新读取当前服务端 revision,不自行递增、不重放旧 revision。
|
|
253
|
-
- 候选选择不等于真实同意。正常流程使用返回的 `services purchase` 完整模板,服务端核对准备同意与实际 quote 后才生成原有价格批准;旧执行的 approve_purchase 模板仅按原范围兼容恢复。
|
|
254
|
-
- 未付且允许修改时修订同一 booking 重新报价;支付已在途/完成、结果未知或退款锁定时按原单读取,不新建替代购买。
|
|
255
|
-
- 乘客身份、电话、邮箱修改只在保护页完成,不在聊天或 workflow 输入收集。
|
|
256
|
-
|
|
257
|
-
## 异常处理
|
|
258
|
-
|
|
259
|
-
execution 不存在或不属于当前设备/账号时返回错误信封,并仅建议:
|
|
11
|
+
## 当前参数
|
|
260
12
|
|
|
261
13
|
```text
|
|
262
|
-
|
|
14
|
+
--since-snapshot <snapshot_id> delta read: suppress the journey payload when
|
|
15
|
+
--timeout <seconds> wait up to 120 seconds for a useful result on
|
|
16
|
+
--json output JSON instead of terminal text
|
|
263
17
|
```
|
|
264
|
-
|
|
265
|
-
不要创建替代 execution 来掩盖归属或状态错误。
|
|
266
|
-
|
|
267
|
-
## Agent Type / Host
|
|
268
|
-
|
|
269
|
-
所有正式支持的 Local Agent Type 返回完全相同的状态、safe payload、instruction 和 next。本命令不渲染二维码,也不包含 Host handoff。
|
|
270
|
-
|
|
271
|
-
## 渐进规划(rail.progressive.v2)
|
|
272
|
-
|
|
273
|
-
智能铁路规划服务在执行读模型上附带 `rail_planning` 投影:`readiness`(pending/ready/expired)、`search.expansion_status`(queued/running/paused/complete/cancelled/failed/expired)、`recommendation` 与 `alternatives` 行程卡片、以及服务端给出的完整 `available_actions` 命令。
|
|
274
|
-
|
|
275
|
-
- `running`/`queued`:稍后按 `next.command` 增量轮询同一执行;不要重新发起查询。
|
|
276
|
-
- `paused`:首批结果已就绪、扩展暂停等待用户意图;`expand_search` 是唯一会再消耗供应商配额的动作。
|
|
277
|
-
- `complete`:扩展收敛;比较任务已满足就展示推荐并停止,购买委托则按明确规则选择。
|
|
278
|
-
- 选票走 `select_journey` 动作:卡片的 `select_delegated` 供已授权委托的 Agent 选择,`select_user_chosen` 仅用于用户亲自选定;乘车人身份信息永远只在受保护 Checkout 页面填写。
|
|
@@ -29,43 +29,10 @@ rail.progressive.v2 中 `<result_item_id>` 也可以是规划快照 ID(`rps_
|
|
|
29
29
|
|
|
30
30
|
需要有效 Agent Device session。
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## 当前分页输出
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
返回同快照的 total、offset、count、下一偏移及完整业务行;页大小受最终输出字节预算约束,不截断一条线路。读尽 next=null;有后页只在还需比较时使用当次完整分页命令,不无意义翻完所有页。诊断或不可用方案保留原因,不把它们当可购买结果。
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
"status": "result_page",
|
|
39
|
-
"result": {
|
|
40
|
-
"service_execution_id": "<id>",
|
|
41
|
-
"service_capability_result_item_id": "<item_id>",
|
|
42
|
-
"offset": 0,
|
|
43
|
-
"limit": 20,
|
|
44
|
-
"total": 63,
|
|
45
|
-
"count": 20,
|
|
46
|
-
"next_offset": 20,
|
|
47
|
-
"page": { "catalog_page": { "...": "..." }, "candidates": [ { "title": "<title>" } ] }
|
|
48
|
-
},
|
|
49
|
-
"instruction": "读取的是已保存结果的同版本分页,不重新查询、不消耗额度。用普通语言向用户说明本页候选;铁路应付与地面估算费用分开表述;不要提及 safe_payload、Execution 或内部 ID。",
|
|
50
|
-
"next": { "command": "itpay services page <id> <item_id> --offset 20 --json", "reason": "读取同版本结果的下一页" },
|
|
51
|
-
"recovery": []
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
`next_offset` 为 `null` 时 `next` 为 `null`;`offset > 0` 时 `recovery` 提供回到第一页的命令。页内候选可携带 `booking_offer`,承接方式与 `services next` 结果一致。
|
|
56
|
-
|
|
57
|
-
铁路 Exact 对已保存的单条车次使用 `--offset <result_offset> --limit 1 --json`,返回 `exact_train_detail`、当前席别代码与名称、库存/报价事实和 `booking_template`。模板中的 `selection.token` 来自服务端,`seat_type` 只能选当前返回的可购代码;人数按用户需求填写。查询价格不等于锁价。
|
|
58
|
-
|
|
59
|
-
## 异常处理
|
|
60
|
-
|
|
61
|
-
`--offset` 非负整数、`--limit` 必须在 `1`–`20` 内,否则在发起请求前返回 `offset_invalid` / `limit_invalid` 信封,不消耗服务端分页。execution 或 result item 不存在、不属于当前设备/账号时返回错误信封,并仅建议:
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
itpay services next <service_execution_id> --json
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
分页读取的是已保存的同版本结果;不要重新发起查询或新建 execution 来"刷新"分页。
|
|
68
|
-
|
|
69
|
-
## Agent Type / Host
|
|
36
|
+
Exact 单车详情使用保存的 result_offset 和 limit=1,给出席别代码/名称、库存与当前完整购买模板。Smart 详情沿返回的同快照入口读取完整多段票计划。当前价格不等于锁价,凭据不自行拼接;完整输入和 continuation 从该详情原样承接。
|
|
70
37
|
|
|
71
|
-
|
|
38
|
+
参数、归属、快照或读取错误按当次真实原因恢复;保存结果读取不触发供应商、不消耗查询额度,不用新查询“刷新”分页。所有宿主使用相同事实。
|
|
@@ -18,4 +18,4 @@ itpay services purchase <service_execution_id> --resume --json
|
|
|
18
18
|
|
|
19
19
|
成功返回已核验官方URL、当前期限和 effects:payment_requested=false、charged=false。图片不可用不阻塞同轮链接交付。人完成官方页面操作后再读取原 Checkout/Order;不能用二维码或人的付款陈述替代后端支付事实。
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
当前合同未声明购买能力时保留原执行并停止;不能绕过兼容检查、创建替代单或改身份。首次读取摘要失败可按返回动作重读;确认提交后响应丢失、恢复失败或官方入口展示读取失败,按返回的原执行 `--resume` 恢复,复用已保存的同意,不重新发送确认。权限、合同或明确过期等错误按实际原因停止。
|