@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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/dist/src/main.js +277 -161
  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 -50
  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 -49
  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 +18 -55
  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 -43
  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 +1 -1
  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 +1 -1
  57. package/package.json +2 -4
  58. package/skills/itpay/SKILL.md +32 -147
  59. package/docs/agent/buyer/quickstart.json +0 -112
  60. package/docs/agent/buyer/rail-fast-checkout.json +0 -48
@@ -1,65 +1,20 @@
1
- # `itpay services quote`
1
+ # itpay services quote
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.
3
+ 仅用于明确要求的独立多服务组合,或当前服务明确返回的动作。普通服务购买使用 services purchase。
4
4
 
5
- ## 范围与意义
6
-
7
- 为当前 Service Execution 的一个付费 Capability 准备 Quote Lock。它只锁定可信输入、候选来源、价格、币种和有效期,不创建 Cart、Checkout、订单或 Provider 调用。
8
-
9
- 本命令是多 Execution 合并付款的高级入口。普通单 Execution 流程应使用 `services checkout`,不要把 `services quote` 当作 Checkout 失败后的替代路径。
10
-
11
- **上游:** 用户明确要求合并多个独立 Execution,且每个 Execution 的 Arazzo workflow 当前都允许 `prepare_quote`。
12
-
13
- **下游:** 读取当前服务器返回的有范围 `approve_purchase` 完整 JSON,默认 false;仅已有真实匹配批准时置 true 并记录。批准成功后再 `cart add --quote`,多个已批准 Quote 可加入同一 Cart。候选选择不等于价格批准。
14
-
15
- ## 语法与参数
16
-
17
- ```bash
18
- itpay services quote <service_execution_id> --capability <capability_id>
19
- [--input <key=value> ...] [--email <delivery_email>] [--json]
5
+ ```sh
6
+ itpay services quote <execution_id> --capability <capability_id> --input <key=value> --json
20
7
  ```
21
8
 
22
- | 参数 | 必填 | 说明 |
23
- |---|---:|---|
24
- | `service_execution_id` | 是 | 候选或输入所属的来源 Execution。 |
25
- | `--capability` | 是 | 当前 `allowed_actions` 明确允许报价的付费 Capability。 |
26
- | `--input` | 条件必填 | 不依赖已批准候选时,提供 schema 要求的输入;可重复。 |
27
- | `--email` | 条件必填 | 仅 `delivery_email_required=true` 时需要,必须来自用户;随 Quote Lock 持久化。 |
28
- | `--json` | 否 | 输出紧凑机器合同。 |
9
+ 实际参数见 --help;使用当前 capability 合同的完整输入。Quote只锁定对象、金额、币种及期限,不代表真实同意、付款或履约。已有原记录由代码处理;Agent只执行当次完整模板和适用动作。
29
10
 
30
- 若 Capability 依赖候选,Backend 只从当前 Execution 的 approved Candidate Action 读取 Result Item、Invocation 和 Stable Hash;CLI 不重新提交公司名、候选 ID 或 Hash。
11
+ ## 当前参数
31
12
 
32
- 交付联系信息属于 Quote 的锁定事实。多个 Quote 合并付款时,Checkout Owner 汇总它们的联系信息;相同字段值冲突时拒绝创建 Checkout,不由 CLI 选择或覆盖。
33
-
34
- ## 标准输出
35
-
36
- ```json
37
- {
38
- "status": "quote_ready",
39
- "result": {
40
- "service_quote_lock_id": "<quote_id>",
41
- "service_execution_id": "<execution_id>",
42
- "capability_id": "<capability_id>",
43
- "price": "<amount> <currency>",
44
- "expires_at": "<RFC3339>"
45
- },
46
- "instruction": "报价已锁定当前 Execution 的可信输入和价格;可单独付款,也可与其他独立 Execution 的报价合并。",
47
- "next": { "command": "itpay cart add --quote <quote_id> --json", "reason": "加入 canonical Cart" },
48
- "recovery": [{ "command": "itpay services next <execution_id> --json", "reason": "重新读取当前 Execution 状态" }]
49
- }
13
+ ```text
14
+ --capability <capability_id>
15
+ --input <key=value> input to lock into the paid service quote
16
+ --email <delivery_email>
17
+ --json output compact JSON
50
18
  ```
51
19
 
52
- 不得返回 locked input、Candidate Hash、Provider 元数据或完整 Execution DTO。
53
-
54
- ## 异常处理
55
-
56
- - `capability_not_quoteable`:Capability 不存在、免费或当前不可报价;回到同一 Execution 的 `services next`。
57
- - `capability_input_invalid`:缺少 required input;不创建 Quote、Cart 或 Checkout。
58
- - `delivery_email_required`:先说明邮箱用于交付 claim link,再询问用户;禁止代填。
59
- - 候选未确认、来自其他 Execution、Quote 已存在冲突:Backend 拒绝且不改变 Execution。
60
- - `service_quote_not_allowed`:当前 Arazzo workflow 不允许从当前 Execution 状态购买该 capability;不得换 capability、新建 Execution 或尝试其他购买命令,只回到同一 Execution 的 `services next`。
61
- - Backend 不支持当前交易合同时返回 `backend_contract_incompatible`,必须停止,不能改用 `services checkout`、`cart`、`buy` 或 `pay` 绕过。
62
-
63
- ## Agent Type / Host
64
-
65
- 所有正式支持的 Local Agent Type 返回相同 Quote 事实、instruction 和 next。本命令不显示二维码;Agent Type 只作为设备与审计上下文,不改变价格或候选规则。
20
+ `--input-json <file>` accepts the complete flat input returned in `file_content`; use it instead of `--input`, never together.
@@ -22,7 +22,7 @@ itpay services read-result <service_execution_id> [--snapshot <snapshot_id>] [--
22
22
  | `--snapshot <snapshot_id>` | 否 | 单独使用时读取该 Smart 已提交快照的紧凑线路页;与 `--journey` 配合时读取该线路详情页。 |
23
23
  | `--offset <offset>` | 否 | Exact / Smart 保存结果从零开始的页偏移;不改变快照或重新查询。 |
24
24
  | `--limit <limit>` | 否 | 保存结果当前页条数,1–20;Exact默认20条,Smart默认3条完整线路或3个票计划;必要时按最终输出字节缩小整行页。 |
25
- | `--all` | 否 | 显式兼容读取 Exact / Smart 保存目录全量;输出可能很大,常规读取应沿当前页的 next.command。 |
25
+ | `--all` | 否 | 显式读取 Exact / Smart 保存目录全量;输出可能很大,常规读取应沿当前页的 next.command。 |
26
26
  | `--json` | 否 | 输出稳定 JSON 信封;未指定时输出相同事实的简洁文本。 |
27
27
 
28
28
  Exact 执行按 offset/limit 读取已保存车次,返回 total、offset、count 和同一 read-result 的续页入口;不会把前100条冒充完整范围。Smart 使用 `--snapshot` 读取固定快照的默认小页,或用 `--journey` 读一条线路的票计划页;按返回的 next.command 续读同快照。这些读取不走 Vault grant。其他服务不带选择器时保持原授权路径。
@@ -35,77 +35,10 @@ CLI 使用已登记设备的签名 session,不接受 Checkout token、Buyer to
35
35
 
36
36
  CLI 直接请求 Backend 的当前有效 Grant。历史 `delivery_bindings` 不作为访问判断;Backend 负责验证当前 Vault、Agent instance、Buyer、scope、TTL 和退款锁。
37
37
 
38
- ## 标准输出
39
-
40
- ```json
41
- {
42
- "status": "granted_result_ready",
43
- "result": {
44
- "service_execution_id": "<id>",
45
- "grant_expires_at": "<RFC3339 time>",
46
- "granted_fields": ["<field>"],
47
- "payload": { "<granted_field>": "<value>" }
48
- },
49
- "instruction": "结果来自当前有效 Vault Grant;只使用本次授权字段,过期后停止读取并重新请求用户同意。",
50
- "next": null,
51
- "recovery": []
52
- }
53
- ```
54
-
55
- 文本输出显示相同的 execution、到期时间、字段名和 payload,不附带 Vault ID、grant ID 或原始 scope。
56
-
57
- ## 异常处理
58
-
59
- 没有当前有效 Vault Grant(包括只有 Agent-visible 历史交付、未授权、过期、撤销或 wrong-scope)时,Backend 返回 `agent_access_denied`。CLI 指向:
60
-
61
- ```text
62
- itpay services next <id> --json
63
- ```
64
-
65
- 不要从历史 Delivery Binding 推断当前模式,也不要使用数据库、Admin API 或新 Device ID 绕过授权。
66
-
67
- 退款访问锁由 Backend 在读取 Vault payload 的同一事务中拒绝:
68
-
69
- ```json
70
- {
71
- "status": "error",
72
- "error": {
73
- "code": "delivery_locked_by_refund",
74
- "message": "delivery is locked by refund <refund_id>"
75
- },
76
- "instruction": "退款访问锁已生效;不要 reveal、创建 grant 或读取交付结果。",
77
- "next": null,
78
- "recovery": [
79
- {
80
- "command": "itpay refund get <refund_id> --json",
81
- "reason": "读取退款权威状态"
82
- }
83
- ]
84
- }
85
- ```
86
-
87
- 其他 `agent_access_denied` 返回:
88
-
89
- ```json
90
- {
91
- "status": "error",
92
- "error": {
93
- "code": "agent_access_denied",
94
- "message": "<server reason>"
95
- },
96
- "instruction": "请用户在订单页面重新授权;不要使用开发者权限绕过授权或退款锁。",
97
- "next": null,
98
- "recovery": [
99
- {
100
- "command": "itpay services next <id> --json",
101
- "reason": "检查交付模式和 grant 状态"
102
- }
103
- ]
104
- }
105
- ```
38
+ ## 结果与授权边界
106
39
 
107
- 一个 grant 只允许读取对应订单、execution、Agent instance 和批准字段。拒绝时不得改用数据库、Admin API 或新 Device ID 绕过。
40
+ 铁路保存结果直接给完整业务行、范围/限制、同快照详情和可用方案的完整购买模板,不要求 Agent 写解析器。完整线路按当前页的 next 续读;只有需要比较时才翻页,不把局部范围说成全网最优。
108
41
 
109
- ## Agent Type / Host
42
+ Vault 结果返回当前 grant 批准字段、TTL 与 payload;历史交付不能代替有效授权。授权不足、过期或退款锁按当前返回的真实原因和原任务动作处理;不能借新 Device、Admin、数据库或旧grant绕过。一个grant不扩展到其他订单、execution或Agent实例。
110
43
 
111
- 同一 Buyer account 下已登记的正式 Local Agent Type 可按政策领取同一订单授权;每个类型仍需自己的有效 Device Authority。所有类型返回相同字段、TTL 和错误,不因 Host 扩大 grant scope。
44
+ 文本与 JSON 使用相同事实。可见授权/官方入口按正式Skill与render-hosts展示,缺宿主信息只补可信上下文,不创建替代购买。没有适用动作时停止。
@@ -1,152 +1,23 @@
1
- # `itpay services run`
1
+ # itpay services run
2
2
 
3
- ## 范围与意义
4
-
5
- 运行 Catalog 中已发布的通用 Buyer workflow。CLI 只提交服务声明要求的输入,并复用现有 Service Execution、Checkout、交付和退款命令;它不解释或执行 Seller 提供的任意命令文本。
6
-
7
- 没有提供输入且未指定现有 execution 时,本命令创建一次 Execution,返回已发布的 JSON input schema,并要求 Agent 继续同一 Execution。已有 Execution 必须通过 `--execution` 恢复,不能创建替代 Execution。
8
-
9
- ## 语法与参数
10
-
11
- ```bash
12
- itpay services run <service_id>
13
- [--input-json <file>]
14
- [--execution <service_execution_id>]
15
- [--timeout <seconds>]
16
- [--host <host>]
17
- [--target <target>]
18
- [--json]
19
- ```
20
-
21
- | 参数 | 说明 |
22
- | --- | --- |
23
- | `service_id` | Catalog 返回的服务 ID。恢复时必须与 Execution 所属服务一致。 |
24
- | `--input-json` | UTF-8 JSON 文件;顶层必须是 object,并符合服务发布的 input schema;文件不超过 256 KiB。文件不可读、非合法 JSON 或顶层非 object 时在本地报 `workflow_input_invalid`,不发生网络写。 |
25
- | `--execution` | 恢复同一 Execution。不得用它切换服务或绕过原状态。 |
26
- | `--timeout` | 本次等待 workflow 状态变化的秒数,默认 120,范围 0–600;超时只返回当前状态。 |
27
- | `--host` / `--target` | Host 展示上下文,不是业务输入或 Buyer 身份。 |
28
- | `--json` | 输出稳定 JSON 信封。 |
29
-
30
- ## 缺少输入
31
-
32
- ```json
33
- {
34
- "status": "input_required",
35
- "result": {
36
- "service_execution_id": "<execution_id>",
37
- "service_id": "<service_id>",
38
- "input_schema": { "type": "object", "required": ["<field>"] }
39
- },
40
- "instruction": "根据服务声明填写输入,然后继续同一服务执行。",
41
- "next": {
42
- "command": "itpay services run <service_id> --execution <execution_id> --input-json <file> --json",
43
- "reason": "提交买家输入"
44
- },
45
- "recovery": []
46
- }
47
- ```
48
-
49
- Agent 必须展示 schema 所需信息并等待用户提供真实输入;不得猜值,也不得为补输入创建新 Execution。
50
-
51
- 铁路 Smart 新版 schema 使用 `endpoints.origin` / `endpoints.destination`,每端独立填写区域 `area`、具体地点 `place` 或准确车站 `station` 与原文 `text`;类型未确定可省略 `kind`。区域、地点和车站的九种组合共用这一输入。以当前执行返回的 `input_schema` 为准:旧 v4 执行仍使用旧字段;新版不可混填旧 `origin` / `destination`、坐标或锁站布尔值。地点/日期实质变更发起关联新查询,沿已保存结果返回的 `new_query_template` 填写真实变化;偏好、人数和期限在相同端点/日期下使用已有 `refine_preferences` 动作。
52
-
53
- ## 执行与付款
54
-
55
- 提供输入后,CLI 使用稳定 idempotency key 向同一 Execution 提交一次。`queued` 或 `running` 只轮询该 Execution。进入付款步骤时,CLI 调用现有 `services checkout`,返回其标准 `human_checkout_required` 输出和 Host handoff;不会实现第二套付款逻辑。
56
-
57
- 付款完成后即使 CLI 已退出,Backend 仍继续该 workflow。再次运行:
58
-
59
- ```bash
60
- itpay services run <service_id> --execution <execution_id> --json
61
- ```
62
-
63
- 只恢复当前状态。交付、Vault 授权和退款继续使用 `services next`、`services read-result`、`vault` 与 `refund` 的既有合同。
64
-
65
- ## 免费试用额度与 `login_required`
66
-
67
- 铁路查询类服务对未登录设备提供按服务独立计数的免费试用(`itpay-rail-exact` 与 `itpay-rail-smart` 各 2 次,互不共享)。额度在查询产生供应商副作用前由服务端原子记账:地点确认、内部多阶段、轮询和已保存结果分页不重复扣次;参数校验失败且未执行查询时不扣次。
68
-
69
- 试用耗尽时,查询在供应商调用**之前**被暂停,Execution 不失败,已提交的输入服务端保留:
70
-
71
- ```json
72
- {
73
- "status": "login_required",
74
- "result": {
75
- "service_execution_id": "<execution_id>",
76
- "service_id": "itpay-rail-exact",
77
- "admission": "login_required",
78
- "query_quota": [
79
- { "service_id": "itpay-rail-exact", "used": 2, "limit": 2, "remaining": 0 },
80
- { "service_id": "itpay-rail-smart", "used": 0, "limit": 2, "remaining": 2 }
81
- ]
82
- },
83
- "instruction": "该服务的免费查询次数已用完(exact 2/2,smart 仍剩 2/2)。请用户在官方页面完成登录后继续免费查询;本次查询输入已保留,登录后恢复同一执行即可,不要新建执行或让用户重述行程。smart 额度属于另一类服务,不能拿它顶替 exact 查询。",
84
- "next": {
85
- "command": "itpay auth login --json",
86
- "reason": "完成官方登录绑定后继续免费查询"
87
- },
88
- "recovery": [
89
- {
90
- "command": "itpay services run itpay-rail-exact --execution <execution_id> --json",
91
- "when": "auth_bound",
92
- "reason": "登录绑定完成后恢复同一查询执行"
93
- }
94
- ]
95
- }
96
- ```
97
-
98
- `query_quota` 如实报告各查询服务自己的 `used`、`limit`、`remaining`。是否暂停只以本次服务端 `admission` 为准;已有结果先正常交付,不把另一服务的额度当作本次授权。
99
-
100
- 登录绑定完成后,再次运行同一条 `services run <service> --execution <id> --json`(不带输入文件):服务端重新读取当前设备绑定身份,被暂停的 Execution 从额度节点继续,不重放已成功的供应商调用,不要求重新输入。`failed`、`recovery_required` 或已完成付款的 Execution 不能以这种方式恢复。
101
-
102
- ## `rate_limited`
103
-
104
- 已注册账号查询不设累计次数上限,但受正常每分钟限流:
105
-
106
- ```json
107
- {
108
- "status": "rate_limited",
109
- "result": {
110
- "service_execution_id": "<execution_id>",
111
- "service_id": "<service_id>",
112
- "admission": "rate_limited",
113
- "retry_after_ms": 42000
114
- },
115
- "instruction": "触发正常限流;等待后恢复同一执行,不要新建查询。",
116
- "next": {
117
- "command": "itpay services run <service_id> --execution <execution_id> --json",
118
- "after_ms": 42000,
119
- "reason": "限流窗口过后继续同一查询"
120
- },
121
- "recovery": []
122
- }
123
- ```
124
-
125
- 限流不是收费、不是试用耗尽、不需要重新登录。等待中不得重复扣试用或发起新的供应商请求。
126
-
127
- ## 公开操作与完整购买承接
128
-
129
- 铁路是一项 `itpay-rail` 服务,`query_exact`、`query_smart`、`prepare_purchase` 是固定定义内的操作。查询输入按返回模板填写 `{ "input": { ... } }`;不要把内部实现当三项公开服务重新发现。
3
+ 执行公开定义返回的当前 operation 或继续原执行。先读取该定义/原结果提供的完整 input_template;复制 file_content 到文件,只填声明的缺失字段。
130
4
 
131
5
  ```sh
132
- itpay services run itpay-rail --operation query_exact --input-json query.json --json
6
+ itpay services run <service_id> --operation <operation_id> --input-json <file> --json
133
7
  ```
134
8
 
135
- 所选行程详情返回完整准备购买模板,含 `continuation.service_execution_id`、`continuation.snapshot_id` 和 `input.selections`。原样保留当前 owner、快照、完整段数、席别代码和人数,写入文件并执行其命令。不要手拼腿、站码、时刻、付款批准或缺失的 snapshot。一次整程对应一个 booking、一个官方付款入口,各段分别出票。
9
+ 公共 operation 文件有外层 input,并按返回保留 continuation。已有执行加 --execution <execution_id>;购买确认文件的形状由 purchase 模板决定,不能混用。
136
10
 
137
- 旧 `itpay-rail-exact/smart/booking` ID 仅用于已有执行和历史模板的兼容恢复;新公共模板与旧凭据共用原购买去重。存在或未知购买先恢复,过期库存不等于能新建购买。
11
+ --timeout 控制本次等待(默认120秒,0表示立即返回);查询累计自动等待由原任务日志记录,恢复不重置。读取 status/result 和当次 next;没有可执行动作就停止。完整铁路路线理解见 rail-booking;必要购买同意见正式 Skill。创建结果未知不自动重发,已知执行编号必须保留。
138
12
 
139
- 候选选择不等于价格和条款同意。正常流程读取返回的 `services purchase` 完整确认;已有真实、匹配价格/上限/条款/主体的同意可复用,缺失或实质变化才补确认。服务端核对实际报价并衔接原有批准;旧执行的 approve_purchase 模板保留原范围保护。付款与出票事实仍由后端及官方页确认。
13
+ ## 当前参数
140
14
 
141
- ## 终态和异常
142
-
143
- - 成功、付款、交付、授权、退款锁等状态使用既有命令的标准信封,不额外包装 Seller 专用格式。
144
- - 既有 Checkout、身份、兼容性和网络错误保持原错误码、instruction 与 recovery;`services run` 不得覆盖可执行的邮箱、登录、升级或状态恢复指令。
145
- - 如果创建 Execution 后未收到完整响应,返回 `workflow_start_outcome_unknown`,只允许先执行 `itpay services list --json` 查找刚创建的 Execution;不得直接重跑 `services run` 创建替代 Execution。
146
- - `recovery_required` 或 `failed` 返回当前 workflow step,`next: null`,并明确禁止重建 Execution 或重放结果未知的 Provider 请求。
147
- - service 不匹配、输入文件不是 JSON object、timeout 越界或 Backend 错误返回 `workflow_run_failed`。
148
- - `--timeout` 到期不是失败,只返回同一 Execution 当前可恢复状态。
149
-
150
- ## Agent Type / Host
151
-
152
- 所有 Local Agent Type 共享同一状态机和 JSON 事实。Host 只改变付款链接、二维码或附件的展示方式,不改变身份、价格、workflow 或交付权限。
15
+ ```text
16
+ --operation <operation_id> operation declared by the public service
17
+ --input-json <file> JSON object containing the service input
18
+ --execution <execution_id> resume the same execution
19
+ --timeout <seconds> maximum wait before returning current progress
20
+ --host <host>
21
+ --target <target>
22
+ --json output JSON
23
+ ```
@@ -1,59 +1,17 @@
1
1
  # `itpay services start`
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.
3
+ ## 读取服务入口
4
4
 
5
- ## 范围与意义
6
-
7
- 公开 service_definition 入口只返回固定版本的服务总览与操作,未创建 execution、未调用 Provider。铁路总览指向 rail-booking:首次实际查询前理解端点并写短摘要。使用返回的操作模板执行 `services run --operation … --input-json <file>`。
8
-
9
- 旧内部 service_id 仍兼容启动一次 Service Execution,并返回当前合法动作,不创建 Checkout 或订单。以下执行示例属于旧入口。
10
-
11
- **上游:** `catalog list` 或服务端明确要求新 execution。
12
- **下游:** `services invoke`、`action`、`checkout` 或 `next`。
13
-
14
- ## 语法与参数
5
+ 从 `catalog list` 选择公开 service_definition,读取固定版本的总览、声明操作和完整输入模板。公开总览不创建 execution、不调用 Provider;不要把读取总览当作已查询库存。
15
6
 
16
7
  ```bash
17
- itpay --agent-type <agent_type> services start <service_id>
18
- [--host <host>] [--target <target>] [--json]
8
+ itpay services start <service_id> [--host <host>] [--target <target>] [--json]
19
9
  ```
20
10
 
21
- `service_id` 必须来自 Catalog。`--target` 只用于需要稳定消息目标的 Host,例如 chat/channel/open ID;它不是搜索词或其他业务输入。Buyer、Device 和 Agent instance 均来自签名 Agent session,不接受请求参数覆盖。
22
-
23
- 本命令不接收 capability 业务输入。它返回 `required_input` 和一条 `services invoke`(或其他当前合法动作)命令;把真实值填入那条命令的重复 `--input key=value`。例如企业关键词是 `--input keyword=美团`,不是 `--target 美团`。
24
-
25
- ## 标准输出
26
-
27
- ```json
28
- {
29
- "status": "ready",
30
- "result": {
31
- "service_execution_id": "<execution_id>",
32
- "service_id": "<service_id>",
33
- "phase": "<phase>",
34
- "capability": {
35
- "capability_id": "<capability_id>",
36
- "required_input": ["<field>"],
37
- "free_quota_limit": 3
38
- }
39
- },
40
- "instruction": "填写首选 capability 的 required_input;一次只提交当前 execution 所代表的服务意图。",
41
- "next": {
42
- "command": "itpay --agent-type <agent_type> services invoke <execution_id> --capability <capability_id> --input <key=value> --json",
43
- "reason": "执行当前允许的能力"
44
- },
45
- "recovery": []
46
- }
47
- ```
11
+ `service_id` 来自当前目录。`--host` 对应实际宿主,`--target` 是该宿主需要的稳定消息目标,不是业务输入。Buyer、Device 和 Agent instance 来自签名会话,不可通过参数覆盖。
48
12
 
49
- Start API 只提供免费额度上限,不提供当前剩余额度,因此本命令不得虚构 `remaining`。不得输出全部 capability DTO、contract version、Arazzo workflow、buyer/device ID 或重复 guidance。若服务不存在,recovery 为 `catalog list`。设备 session 由 CLI 自动登记或刷新;401 `agent_device_session_required` 仅续期并重试一次,仍失败时返回错误,不循环。
13
+ 本命令不接收业务输入。使用返回的声明操作与完整 `input_template.file_content` 写 JSON 文件,再执行该模板的 `services run --operation … --input-json <file>`;保留外层 `input` 与返回的 continuation。占位模板须填入实际值后执行,不猜字段或 operation。
50
14
 
51
- ## Agent Type / Host
15
+ 铁路首次实际查询前按 `rail-booking` 理解完整端点、用户锁站与约束,必要时短查,留下2–4行路线摘要,再查询。查询结果、详情和整程购买沿当前返回动作继续;购买仅补缺失的真实同意。
52
16
 
53
- | Agent Type | 默认行为 |
54
- |---|---|
55
- | `codex-desktop` | 登记该类型并使用 `codex` Host instruction。 |
56
- | `codex-cli` | 登记该类型并使用 terminal instruction。 |
57
- | `claude-code-desktop` | 登记该类型并使用 `claude-code` Host instruction。 |
58
- | `claude-code-cli` | 登记该类型并使用 terminal instruction。 |
59
- | `workbuddy` | 登记该类型并使用 plain-chat instruction。 |
17
+ 只使用当前返回的合法动作。缺少声明合同或不兼容时保留原执行并停止,不绕过检查创建替代执行。免费额度上限不是当前剩余额度;登录、权限与外部故障按实际错误恢复。
@@ -43,8 +43,7 @@ Skill 不能默认把 Agent 引向 Catalog:用户可能要读取以前购买
43
43
  ```
44
44
 
45
45
  未知 Skill 名称返回 `skill_not_found`;包内文件缺失或损坏返回
46
- `skill_unavailable`。除完整已发布 Skill 内容外,不得附加本地路径、安装
47
- 目录、环境变量、Device 状态或 Backend 数据。
46
+ `skill_unavailable`。正常读取只返回完整同包 Skill,不附加设备或Backend数据;读取错误仅采用当次允许的同包路径和真实原因,不猜安装目录。
48
47
 
49
48
  `workbuddy` 只在 instruction 中增加既有的本地权限要求;不改变输入、输出
50
49
  schema 或意图路由。
@@ -44,24 +44,6 @@ Agent不得提取、单独输出、记录或重建其中的 credential;但不
44
44
  失效。因此本命令只能按读取命令返回的 `next` 执行一次,不能用重复执行
45
45
  `vault access` 检查状态。
46
46
 
47
- ## Host handoff
47
+ ## 宿主交付
48
48
 
49
- | Agent Type / Host | `handoff` keys |
50
- | --- | --- |
51
- | `codex-desktop / codex` | `url, qr_local_path, markdown` |
52
- | `claude-code-desktop / claude-code` | `url, qr_local_path, markdown` |
53
- | `codex-cli / terminal` | `url`;文本模式同时渲染终端二维码 |
54
- | `claude-code-cli / terminal` | `url`;文本模式同时渲染终端二维码 |
55
- | `workbuddy / plain-chat` | `url, agent_action` |
56
- | `zcode / plain-chat` | `url`;立即用内置浏览器打开,浏览器不可用时才展示可点击链接 |
57
- | `doubao-work / plain-chat` | `url, qr_image_url`;展示“直接打开授权页”和“授权二维码图片(保存或用另一台设备扫码)”两个有标签的官方入口 |
58
- | `kimi-code / terminal` | `url`;文本模式同时渲染终端二维码 |
59
- | `openclaw / telegram` | `url, qr_image_url, agent_action` |
60
- | `openclaw / other` | `url, qr_image_url` |
61
-
62
- 桌面二维码下载失败时保留 `handoff.url`,instruction 必须要求如实说明图片
63
- 未显示并发送同一个 URL;不得创建替代请求。
64
-
65
- ZCode 不接收图片路径或二维码 URL。instruction 必须要求 Agent立即用内置浏览器打开完整 `handoff.url`,然后停止等待;不得只粘贴文字链接或重建二维码。仅当内置浏览器明确不可用时才展示同一个可点击链接。
66
-
67
- Doubao Work 的两个字段都是必需项。若兼容 Backend 未直接返回二维码 URL,CLI 必须从同一官方授权入口派生 Backend 的对应二维码端点;无法安全派生时命令必须明确失败,不得返回缺字段的 handoff。instruction 必须要求 Agent 同时展示完整 `handoff.url` 与 `handoff.qr_image_url`,清楚区分直接打开与跨设备扫码用途,然后停止等待。不得解析 credential、下载或重建二维码,也不得重复执行 `vault access` 检查状态。
49
+ 使用当前 handoff 和正式 Skill/render-hosts;原生工具或可选图片不可用时,同轮给出原官方URL,不创建替代授权、不把未展示说成成功。授权交付后停止,人完成后只运行最初的reader。host只改变展示,不扩展权限。
@@ -44,23 +44,10 @@ itpay vault list [--query <text>] [--limit <1..50>] [--cursor <cursor>] [--host
44
44
 
45
45
  ## 授权缺失
46
46
 
47
- ```json
48
- {
49
- "status": "human_authorization_required",
50
- "result": {
51
- "intent": "list_purchased_content",
52
- "query": "<original-query-or-empty>"
53
- },
54
- "instruction": "需要用户确认一次身份和只读权限;执行 next.command 生成入口,不要声称链接已经创建。",
55
- "next": {
56
- "command": "itpay vault access --json",
57
- "reason": "创建一次账号读取授权"
58
- },
59
- "recovery": []
60
- }
61
- ```
47
+ 授权缺失返回 human_authorization_required。上下文完整时只执行当次完整的账号授权 next 一次;缺 host/target 时 next=null,使用返回的不可执行完整模板从当前可信会话补齐,不把通用示例套到所有宿主。真实交付入口后停止,授权不等于购买或付款。
48
+
62
49
 
63
50
  授权完成后只重新运行原始 `vault list` 命令,保留 query、limit 和 cursor。
64
51
  无效 limit/cursor 在 HTTP 前返回稳定错误。授权过期不自动重试、不创建新
65
52
  Device。OpenClaw 的授权下一步保留原命令的 `--host` 和所需 `--target`;若原
66
- 命令没有提供,CLI 使用明确占位符要求 Agent 从当前可信会话补齐。
53
+ 命令没有提供,next=null,并返回不可执行的完整输入模板,由Agent从当前可信会话补齐。
@@ -37,4 +37,4 @@ Agent不得向用户展示或要求用户输入 `artifact_ref`。
37
37
 
38
38
  账号或内容授权完成后都只恢复原始 read;`vault access` 不是状态查询命令。
39
39
  OpenClaw 应把当前可信会话的 `--host` 和所需 `--target` 传给 read,使授权下一
40
- 步可以原样保留展示目标;没有上下文时 CLI 只返回明确占位符,不猜测目标。
40
+ 步可以原样保留展示目标;没有上下文时 next=null,CLI返回不可执行的完整输入模板,不猜测目标。
@@ -94,7 +94,7 @@ CLI 只把“尚未收到完整 HTTP 响应”的临时传输异常映射为稳
94
94
  - `network_socket_error`
95
95
  - `network_transport_failed`
96
96
 
97
- 所有命令的 JSON 错误继续使用标准错误外壳,并额外返回:
97
+ 传输错误继续使用标准外壳及实际尝试事实;以下是结构示意,不提供可执行命令:
98
98
 
99
99
  ```json
100
100
  {
@@ -103,7 +103,7 @@ CLI 只把“尚未收到完整 HTTP 响应”的临时传输异常映射为稳
103
103
  "result": { "attempts": 3, "automatic_retry_performed": true },
104
104
  "instruction": "临时网络故障;CLI 已仅对可安全重放的操作完成有限自动重试,但仍未获得完整响应。按 recovery 查询同一资源的权威状态;不要创建替代 Checkout、Execution、Payment 或 Refund。",
105
105
  "next": null,
106
- "recovery": [{ "command": "itpay <same-resource-read-command>", "reason": "读取同一资源的权威状态" }]
106
+ "recovery": []
107
107
  }
108
108
  ```
109
109
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  - [输出与错误合同](conventions.md)
12
12
  - [Agent Type 与 Host](agent-types.md)
13
- - 所有示例中的 `<...>` 都是占位符,不得原样提交。
13
+ - 语法与结构示意中的 `<...>` 都不可执行;实际 next/recovery 只能使用当前返回的完整命令,待填字段使用 executable:false 的完整 file_content 模板。
14
14
  - 所有 commerce 命令必须使用真实的 `--agent-type`,不得为刷新额度伪造类型。
15
15
  - 每条命令只返回当前步骤所需事实、一条 instruction、一个首选 next;异常时最多返回两个 recovery。
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itpay/cli",
3
- "version": "2.1.48",
3
+ "version": "2.1.49",
4
4
  "description": "The ItPay CLI for services, orders, and human-authorized purchased content.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,9 +26,7 @@
26
26
  "docs/agent/buyer/orders-refunds.json",
27
27
  "docs/agent/buyer/payment-flow.json",
28
28
  "docs/agent/buyer/purchased-content.json",
29
- "docs/agent/buyer/quickstart.json",
30
29
  "docs/agent/buyer/rail-booking.json",
31
- "docs/agent/buyer/rail-fast-checkout.json",
32
30
  "docs/agent/buyer/render-hosts.json",
33
31
  "docs/agent/buyer/service-feedback.json",
34
32
  "docs/cli-reference/agent-types.md",
@@ -142,5 +140,5 @@
142
140
  "url": "git+https://github.com/itpay-ai/cli.git"
143
141
  },
144
142
  "itpayBundleFormat": "buyer-esm-v1",
145
- "gitHead": "5165ffbbcac542b4348996deebcad10280e3e88c"
143
+ "gitHead": "4737843bf7284dafb143f493f484b4a9ceb884d3"
146
144
  }