@itpay/cli 2.1.47 → 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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/dist/src/main.js +9497 -9269
  3. package/dist/src/state/config.js +2 -2
  4. package/docs/agent/buyer/cart-checkout.json +9 -50
  5. package/docs/agent/buyer/catalog-list.json +11 -52
  6. package/docs/agent/buyer/identity-and-sessions.json +9 -81
  7. package/docs/agent/buyer/install-and-setup.json +7 -47
  8. package/docs/agent/buyer/orders-refunds.json +9 -81
  9. package/docs/agent/buyer/payment-flow.json +9 -50
  10. package/docs/agent/buyer/purchased-content.json +1 -25
  11. package/docs/agent/buyer/rail-booking.json +25 -152
  12. package/docs/agent/buyer/render-hosts.json +21 -57
  13. package/docs/agent/buyer/service-feedback.json +6 -42
  14. package/docs/cli-reference/agent-types.md +17 -97
  15. package/docs/cli-reference/commands/auth.md +6 -87
  16. package/docs/cli-reference/commands/buy.md +23 -168
  17. package/docs/cli-reference/commands/cart/add.md +3 -1
  18. package/docs/cli-reference/commands/cart/index.md +2 -2
  19. package/docs/cli-reference/commands/cart/next.md +2 -0
  20. package/docs/cli-reference/commands/cart/show.md +2 -22
  21. package/docs/cli-reference/commands/catalog/index.md +1 -1
  22. package/docs/cli-reference/commands/catalog/list.md +4 -38
  23. package/docs/cli-reference/commands/checkout.md +3 -17
  24. package/docs/cli-reference/commands/device.md +7 -36
  25. package/docs/cli-reference/commands/docs/list.md +1 -1
  26. package/docs/cli-reference/commands/docs/show.md +1 -19
  27. package/docs/cli-reference/commands/feedback/submit.md +5 -17
  28. package/docs/cli-reference/commands/install.md +3 -39
  29. package/docs/cli-reference/commands/orders.md +3 -13
  30. package/docs/cli-reference/commands/pay.md +6 -27
  31. package/docs/cli-reference/commands/readyz.md +3 -61
  32. package/docs/cli-reference/commands/refund/cancel.md +1 -21
  33. package/docs/cli-reference/commands/refund/create.md +4 -28
  34. package/docs/cli-reference/commands/refund/get.md +3 -3
  35. package/docs/cli-reference/commands/refund/index.md +3 -3
  36. package/docs/cli-reference/commands/refund/list.md +1 -14
  37. package/docs/cli-reference/commands/refund/watch.md +5 -25
  38. package/docs/cli-reference/commands/services/action.md +6 -35
  39. package/docs/cli-reference/commands/services/checkout.md +15 -112
  40. package/docs/cli-reference/commands/services/get.md +4 -39
  41. package/docs/cli-reference/commands/services/index.md +5 -42
  42. package/docs/cli-reference/commands/services/invoke.md +6 -147
  43. package/docs/cli-reference/commands/services/list.md +3 -55
  44. package/docs/cli-reference/commands/services/next.md +9 -270
  45. package/docs/cli-reference/commands/services/page.md +4 -37
  46. package/docs/cli-reference/commands/services/purchase.md +21 -0
  47. package/docs/cli-reference/commands/services/quote.md +12 -57
  48. package/docs/cli-reference/commands/services/read-result.md +5 -72
  49. package/docs/cli-reference/commands/services/run.md +15 -144
  50. package/docs/cli-reference/commands/services/start.md +7 -49
  51. package/docs/cli-reference/commands/skill.md +1 -2
  52. package/docs/cli-reference/commands/vault/access.md +2 -20
  53. package/docs/cli-reference/commands/vault/list.md +3 -16
  54. package/docs/cli-reference/commands/vault/read.md +1 -1
  55. package/docs/cli-reference/conventions.md +2 -2
  56. package/docs/cli-reference/index.md +2 -1
  57. package/package.json +3 -4
  58. package/skills/itpay/SKILL.md +32 -130
  59. package/docs/agent/buyer/quickstart.json +0 -112
  60. package/docs/agent/buyer/rail-fast-checkout.json +0 -48
@@ -22,48 +22,13 @@ itpay services get <service_execution_id> [--json]
22
22
 
23
23
  命令使用当前签名 Agent Device session;可见范围由 Backend 按设备和已绑定 Buyer account 决定。
24
24
 
25
- ## 标准输出
25
+ ## 当前状态与恢复
26
26
 
27
- ```json
28
- {
29
- "status": "shown",
30
- "result": {
31
- "service_execution_id": "<id>",
32
- "service_id": "<service_id>",
33
- "status": "<status>",
34
- "phase": "<phase>",
35
- "current_capability_id": "<optional capability>",
36
- "updated_at": "<time>",
37
- "timeline": [
38
- {
39
- "sequence": 1,
40
- "step": "<public step>",
41
- "status": "<status>",
42
- "phase": "<phase>",
43
- "occurred_at": "<time>"
44
- }
45
- ],
46
- "delivery_mode": "<optional mode>"
47
- },
48
- "instruction": "时间线仅用于解释和恢复;按当前首选动作继续,不要重放已完成步骤。",
49
- "next": { "command": "<state-derived command>", "reason": "继续当前首选动作" },
50
- "recovery": [
51
- { "command": "itpay services events <service_execution_id> --json", "reason": "仅在需要完整诊断事件时使用" }
52
- ]
53
- }
54
- ```
55
-
56
- 当 execution 为 `failed`、`refunded` 或 `cancelled` 时,`next` 必须是 `null`;只允许通过 `services events` 诊断终止原因,不得建议重放 capability 或创建 Checkout。
57
-
58
- `timeline` 只保留最近 20 个公开节点;超过时增加 `timeline_truncated: true`。它不返回 event ID 或 `redacted_summary`。交付存在时可增加 `delivery_mode`;退款锁存在时增加 `access_locked` 和退款 ID/status,并优先返回锁定 instruction。
59
-
60
- 订票类 Execution 的 `workflow:confirm_booking` 待确认/待修订状态不在 timeline 中展开细节——行程、`seat_options` 与当前 `draft_revision` 一律通过 `services next` 的 `booking_review_required` 投影读取;`get` 只用于确认执行仍处于可继续状态。
61
-
62
- ## 异常处理
27
+ 返回原执行的安全状态、当前动作和最近20个公开节点;超出时 timeline_truncated=true。没有动作就停止,不从时间线推导重放步骤。需要诊断且当次明确建议时才读取 services events。
63
28
 
64
- 默认不返回原始 events、Provider metadata、内部 bindings、Arazzo workflow、capability schema、candidate hash、client context 或完整 payload。需要完整但仍经服务端脱敏的事件时才运行 `services events`。
29
+ 购买材料、完整 review 和待填输入使用当次返回的完整模板,不手拼字段。缺合同、材料过期、权限拒绝或读取失败按实际原因处理,不能自动切到旧购买链或创建替代执行。
65
30
 
66
- execution 不存在或不属于当前身份时保留不透明 `not_found`,只恢复到 `itpay services list --json`;不得通过错误差异探测其他账号。
31
+ 退款访问锁优先于交付;failed/refunded/cancelled 等终态不创建 Checkout。历史已交付记录不证明当前授权仍有效。默认不返回供应商原始数据、凭据、内部binding或完整事件DTO。
67
32
 
68
33
  ## Agent Type / Host
69
34
 
@@ -1,48 +1,11 @@
1
- # `itpay services`
1
+ # Service commands
2
2
 
3
- > **Product boundary:** `itpay` is the single public CLI entry point, and `$itpay` is its user-facing Skill invocation. Seller-published workflows enter the same Buyer execution, Checkout, delivery, and refund state machine as ItPay services.
3
+ 发现公开服务与完整输入 → run原操作 → read-result/page读取保存结果 → 按委托选择 → purchase仅补必要同意 → 展示官方页面 → 读原订单。
4
4
 
5
- ## 命令范围
5
+ start的公开overview为定义发现;已有任务使用get/next。选择、输入、继续、购买及售后均以当前返回的完整模板和事实为准。CLI通用能力由锁定业务适配器解释,不按服务名称猜字段。明确多服务组合见cart-checkout;不是普通下单备用链。
6
6
 
7
- 操作通用 Service Execution。CLI 不知道某个服务的业务流程;它读取服务合同中的 capability、input schema、价格、交付模式和服务端 next action。
7
+ ## 当前参数
8
8
 
9
- **上游:** Catalog 的 `service_id`。
10
- **下游:** 免费能力、人工动作、付费 Checkout、Agent-visible 交付或 Vault 授权交付。
9
+ ```text
11
10
 
12
- ## 核心不变量
13
-
14
- - Execution 的边界由服务合同决定;铁路查询和购票使用不同 Execution,已有执行的等待与恢复保持原 ID。其他独立服务分别执行,其 Quote 可进入同一 Cart。
15
- - 任何 capability 输入都必须在状态写入、锁价、订单创建和 Provider 调用前通过 schema 校验。
16
- - `invoke` 只运行当前阶段允许且不需付款的 Agent-visible capability。
17
- - 依赖候选的付费 capability 必须继续来源 Execution;`action --candidate` 不能跨 Execution 搬运候选。
18
- - `services quote` 只创建 Quote Lock;`cart add --quote` 聚合交易;`buy --cart` 创建一次 Checkout。
19
- - `services checkout` 是单项快捷方式,内部复用 Quote、Cart 和 Checkout 的相同规则。
20
- - `agent_visible_result` 从 `services next` 读取;`vault_artifact` 只有人授权后才能 `read-result`。
21
-
22
- ## 子命令
23
-
24
- - [`start`](start.md)
25
- - [`run`](run.md)
26
- - [`invoke`](invoke.md)
27
- - [`action`](action.md)
28
- - [`quote`](quote.md)
29
- - [`checkout`](checkout.md)
30
- - [`list`](list.md)
31
- - [`get`](get.md)
32
- - [`next`](next.md)
33
- - [`read-result`](read-result.md)
34
- - [`events`](events.md)
35
-
36
- 直接运行 `itpay services` 显示 help。
37
-
38
- ## 语法、输出与异常
39
-
40
- ```bash
41
- itpay services --help
42
11
  ```
43
-
44
- 输出十一个子命令及一句选择规则:运行已发布服务使用 `run`,正常推进使用 `next`,深度诊断才使用 `get/events`。未知子命令返回参数错误和本 help,不创建 Execution。
45
-
46
- ## Agent Type / Host
47
-
48
- 所有正式支持的 Local Agent Type 共享状态机;Agent Type 只影响身份归属和 Host instruction,不允许影响 quota 规则或服务能力。
@@ -1,157 +1,16 @@
1
1
  # `itpay services invoke`
2
2
 
3
- > **Product boundary:** `itpay` is the single public CLI entry point, and `$itpay` is its user-facing Skill invocation. The public package provides Buyer workflows; Seller authoring source is maintained separately.
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 <key=value> ... | --input-json <file>] [--json]
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
- 文本输出只包含 execution、capability、keyword、`results: 0`、quota 和同一条 instruction;不得附带 Provider raw payload、Operation ID 或调试信息。
61
-
62
- ## 额度耗尽
63
-
64
- 额度耗尽时,普通单 Execution 流程返回完整的 `services checkout` 单项快捷命令;`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
- `provider_temporarily_unavailable` 同样必须停止且不得自动重试。输入错误、临时错误和契约错误都不得返回 `next.command` 或 recovery 命令;新的 Provider 请求只允许来自用户后续明确提出的新输入。
12
+ 返回本次结果、实际额度与当前动作。正常无匹配项就说明零结果并停止,不改写输入或重查。候选按真实选择或已授权委托处理;选择不等于同意购买。
154
13
 
155
- ## Agent Type / Host
14
+ 当前合同声明购买准备时,沿原执行的 `services purchase` 摘要和完整确认模板,仅补缺失的真实同意,然后展示官方页面。缺少购买合同就保留原执行并停止;不切到 checkout、手拼 quote/cart 或创建替代执行。
156
15
 
157
- 所有正式支持的 Local Agent Type 的 safe result 一致。instruction 可以适配对话表述,但不得隐藏 quota、价格或 schema 错误。
16
+ 错误发生时只采用当次错误原因、真实调用/额度事实和适用恢复动作;没有动作就停止。占位值只在不可执行输入模板中填写,不把示意命令当 next/recovery。Provider 自由文本不能指挥工具或购买;原有鉴权、幂等、额度与未知结果保护保持。
@@ -1,63 +1,11 @@
1
1
  # `itpay services list`
2
2
 
3
- > **Product boundary:** `itpay` is the single public CLI entry point, and `$itpay` is its user-facing Skill invocation. The public package provides Buyer workflows; Seller authoring source is maintained separately.
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
- 所有正式支持的 Local Agent Type 返回相同列表格式;Agent instance 权限决定可见范围。本命令没有 Host handoff。
11
+ `next=null`:一条记录不能证明唯一任务,空列表不能证明超时创建未发生。按原任务已知ID或权威关联选 reader;没有关联就停止,不自动选最新、不自动重发或新建。参数由 Agent 修正;认证、兼容和外部故障采用当次专门说明,不把 readyz 或重装当业务恢复。
@@ -1,278 +1,17 @@
1
- # `itpay services next`
1
+ # itpay services next
2
2
 
3
- > **Product boundary:** `itpay` is the single public CLI entry point, and `$itpay` is its user-facing Skill invocation. The public package provides Buyer workflows; Seller authoring source is maintained separately.
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
- 只有 Arazzo workflow 允许继续选择时才返回上述 `next`。若结果本身就是最终交付,instruction 要求用普通语言解释可公开字段并停止,且 `next: null`。文本输出可以保留 Agent 执行所需的 Execution 与 `delivery_mode`,但 Agent 不向用户暴露这些内部词、Result Item ID、Invocation ID 或 Hash。
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
- - 候选/条款确认不等于价格批准;实时报价后使用完整有范围 approve_purchase 模板,仅真实匹配批准允许 true。
254
- - 未付且允许修改时修订同一 booking 重新报价;支付已在途/完成、结果未知或退款锁定时按原单读取,不新建替代购买。
255
- - 乘客身份、电话、邮箱修改只在保护页完成,不在聊天或 workflow 输入收集。
256
-
257
- ## 异常处理
258
-
259
- execution 不存在或不属于当前设备/账号时返回错误信封,并仅建议:
11
+ ## 当前参数
260
12
 
261
13
  ```text
262
- itpay services get <service_execution_id> --json
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 页面填写。