@itpay/cli 2.0.5 → 2.0.7
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 +8 -4
- package/dist/src/client/http.js +29 -23
- package/dist/src/commands/catalog.js +3 -2
- package/dist/src/commands/checkout.js +23 -13
- package/dist/src/commands/guidance.js +37 -13
- package/dist/src/commands/readyz.js +3 -3
- package/dist/src/commands/services.js +122 -41
- package/dist/src/commands/skill.js +55 -0
- package/dist/src/main.js +116 -7
- package/dist/src/state/agent_type.js +19 -0
- package/dist/src/state/config.js +5 -13
- package/dist/src/state/device_authority.js +174 -56
- package/docs/agent/buyer/catalog-list.json +2 -1
- package/docs/agent/buyer/identity-and-sessions.json +64 -0
- package/docs/agent/buyer/install-and-setup.json +19 -5
- package/docs/agent/buyer/payment-flow.json +5 -1
- package/docs/agent/buyer/quickstart.json +12 -4
- package/docs/cli-reference/agent-types.md +9 -3
- package/docs/cli-reference/commands/catalog/list.md +1 -1
- package/docs/cli-reference/commands/checkout.md +4 -4
- package/docs/cli-reference/commands/device.md +13 -0
- package/docs/cli-reference/commands/install.md +3 -1
- package/docs/cli-reference/commands/readyz.md +4 -5
- package/docs/cli-reference/commands/services/action.md +10 -5
- package/docs/cli-reference/commands/services/checkout.md +3 -3
- package/docs/cli-reference/commands/services/invoke.md +6 -6
- package/docs/cli-reference/commands/services/next.md +23 -4
- package/docs/cli-reference/commands/services/quote.md +5 -1
- package/docs/cli-reference/commands/services/start.md +5 -3
- package/docs/cli-reference/commands/skill.md +17 -0
- package/docs/cli-reference/conventions.md +4 -1
- package/docs/cli-reference/index.md +1 -0
- package/package.json +1 -1
- package/skills/itpay-buyer/SKILL.md +33 -6
|
@@ -26,17 +26,22 @@ itpay services action <service_execution_id> --action <action_type>
|
|
|
26
26
|
"status": "candidate_selected",
|
|
27
27
|
"result": {
|
|
28
28
|
"service_execution_id": "<id>",
|
|
29
|
-
"candidate": { "rank": 2, "title": "<title>" }
|
|
29
|
+
"candidate": { "rank": 2, "title": "<title>" },
|
|
30
|
+
"checkout": {
|
|
31
|
+
"capability_id": "<paid_capability_id>",
|
|
32
|
+
"price": { "amount_minor": 50, "currency": "CNY" },
|
|
33
|
+
"delivery_email_required": true
|
|
34
|
+
}
|
|
30
35
|
},
|
|
31
|
-
"instruction": "
|
|
32
|
-
"next": { "command": "itpay services
|
|
36
|
+
"instruction": "候选已绑定到当前 Execution,但尚未购买后续服务。现在只向用户说明已选择的候选、后续价格和邮箱用途,然后询问是否购买并停止。用户明确同意并提供邮箱前,不要执行 next.command,不要创建新 Execution 或 Checkout。",
|
|
37
|
+
"next": { "command": "itpay services checkout <id> --capability <capability_id> --email <email> --json", "reason": "仅在用户明确同意价格并提供真实邮箱后执行" },
|
|
33
38
|
"recovery": [{ "command": "itpay services next <id> --json", "reason": "重新读取服务端允许的动作" }]
|
|
34
39
|
}
|
|
35
40
|
```
|
|
36
41
|
|
|
37
|
-
`next` 来自 action 写入后重新读取的类型化 `allowed_actions`,不是 CLI
|
|
42
|
+
`next` 来自 action 写入后重新读取的类型化 `allowed_actions`,不是 CLI 根据服务名猜测。普通单 Execution 的付费 continuation 使用 `services checkout`;候选选择本身不代表用户已经同意购买。没有合法动作时返回 `next: null`。非候选 action 仍返回 `action_recorded` 并引导 `services next`。
|
|
38
43
|
|
|
39
|
-
rank 不存在、属于旧结果集或其他 Execution、action 不允许、status 非法时均不写 action
|
|
44
|
+
rank 不存在、属于旧结果集或其他 Execution、action 不允许、status 非法时均不写 action;返回结构化错误并且只引导同一 Execution 的 `services next`。不得新建 Execution、重新 invoke 或构造候选 ID。相同候选重试幂等;同一结果集改选另一个候选返回冲突,不覆盖已批准事实。
|
|
40
45
|
|
|
41
46
|
## Agent Type / Host
|
|
42
47
|
|
|
@@ -33,8 +33,8 @@ itpay services checkout <service_execution_id> --resume
|
|
|
33
33
|
"amount": "<amount> <currency>"
|
|
34
34
|
},
|
|
35
35
|
"handoff": { "url": "<checkout_url>", "qr_local_path": "<host_optional_path>", "markdown": "<host_optional_markdown>" },
|
|
36
|
-
"instruction": "
|
|
37
|
-
"next": { "command": "itpay checkout --id <checkout_id> --token <display_token>", "reason": "
|
|
36
|
+
"instruction": "把付款链接、可用二维码和金额实际发送给用户,然后停止并等待。不要立即执行 next.command,不要创建第二个 Checkout,不要新建 Execution,不要调用 pay。用户表示已经完成付款或要求查询状态后,只执行 next.command;用户的话本身不是付款成功证明。",
|
|
37
|
+
"next": { "command": "itpay checkout --id <checkout_id> --token <display_token> --json", "reason": "仅在用户完成付款操作或要求查询后,读取同一 Checkout 的权威状态" },
|
|
38
38
|
"recovery": []
|
|
39
39
|
}
|
|
40
40
|
```
|
|
@@ -79,4 +79,4 @@ itpay services checkout <service_execution_id> --resume
|
|
|
79
79
|
| `codex-cli` | `handoff={url,qr_local_path}`;普通文本模式在用户可见终端渲染二维码。 |
|
|
80
80
|
| `claude-code-desktop` | `handoff={url,qr_local_path,markdown}`;把 `handoff.markdown` 原样发送到当前桌面对话。 |
|
|
81
81
|
| `claude-code-cli` | `handoff={url,qr_local_path}`;普通文本模式在用户可见终端渲染二维码。 |
|
|
82
|
-
| `workbuddy` | `handoff={url,qr_local_path,qr_image_url}
|
|
82
|
+
| `workbuddy` | `handoff={url,qr_local_path,qr_image_url}`;发送可点击链接,优先把本地路径作为图片附件,不能发送本地附件时使用绝对图片 URL;发送金额后停止等待。 |
|
|
@@ -27,7 +27,7 @@ itpay services invoke <service_execution_id> --capability <capability_id>
|
|
|
27
27
|
"items": [{ "rank": 1, "title": "<title>", "safe_payload": {} }],
|
|
28
28
|
"quota": { "remaining": 2, "limit": 3 }
|
|
29
29
|
},
|
|
30
|
-
"instruction": "向用户展示编号和 safe_payload
|
|
30
|
+
"instruction": "向用户展示编号和 safe_payload;若候选列表已满足用户目标,在此停止。仅在用户明确选择并希望继续时,才在当前 Execution 提交对应 rank。",
|
|
31
31
|
"next": { "command": "itpay services action <id> --action <action_type> --actor-type human --status approved --candidate <rank> --json", "reason": "记录用户选择" },
|
|
32
32
|
"recovery": []
|
|
33
33
|
}
|
|
@@ -35,7 +35,7 @@ itpay services invoke <service_execution_id> --capability <capability_id>
|
|
|
35
35
|
|
|
36
36
|
## 无结果与额度耗尽
|
|
37
37
|
|
|
38
|
-
无结果时明确说明 Provider 已返回空结果,并根据服务端 graph 决定重试同一 execution 或启动新 execution
|
|
38
|
+
无结果时明确说明 Provider 已返回空结果,并根据服务端 graph 决定重试同一 execution 或启动新 execution。额度耗尽时,普通单 Execution 流程返回完整的 `services checkout` 单项快捷命令;`services quote -> cart add --quote -> buy --cart` 只用于用户明确要求把多个独立 Execution 合并付款的高级流程。
|
|
39
39
|
|
|
40
40
|
```json
|
|
41
41
|
{
|
|
@@ -51,16 +51,16 @@ itpay services invoke <service_execution_id> --capability <capability_id>
|
|
|
51
51
|
"delivery_email_required": false
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"instruction": "
|
|
54
|
+
"instruction": "免费额度已用完,本次没有调用 Provider,也尚未创建 Quote 或 Checkout。现在只向用户说明:‘继续当前请求需要支付 0.10 CNY,是否购买?’然后停止并等待用户明确回复。用户明确同意前,不要执行 next.command,不要新建 Execution,不要尝试其他 capability、quote、cart、buy、checkout 或 pay 命令。",
|
|
55
55
|
"next": {
|
|
56
|
-
"command": "itpay services
|
|
57
|
-
"reason": "
|
|
56
|
+
"command": "itpay services checkout <id> --capability <paid_capability_id> --input <key=value> --json",
|
|
57
|
+
"reason": "仅在用户明确同意支付 0.10 CNY 后执行;否则停止"
|
|
58
58
|
},
|
|
59
59
|
"recovery": []
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
缺少 required input 时返回 `capability_input_invalid`,recovery 给出带占位符的同一 invoke 命令;CLI 和 Backend 都必须在 Provider 调用前拒绝,Backend 还必须在 execution/event/quota/invocation 写入前拒绝。错误调用付费 capability
|
|
63
|
+
缺少 required input 时返回 `capability_input_invalid`,recovery 给出带占位符的同一 invoke 命令;CLI 和 Backend 都必须在 Provider 调用前拒绝,Backend 还必须在 execution/event/quota/invocation 写入前拒绝。错误调用付费 capability 时不得给出购买旁路,只能回到同一 Execution 的 `services next`;execution 状态、event、ProviderCalled 均保持不变。
|
|
64
64
|
|
|
65
65
|
## Agent Type / Host
|
|
66
66
|
|
|
@@ -37,7 +37,7 @@ itpay services next <service_execution_id> [--json]
|
|
|
37
37
|
{ "rank": 1, "title": "<title>", "safe_payload": { "<public_field>": "<value>" } }
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
|
-
"instruction": "向用户展示编号和 safe_payload
|
|
40
|
+
"instruction": "向用户展示编号和 safe_payload;若候选列表已满足用户目标,在此停止。仅在用户明确选择并希望继续时,才在当前 Execution 提交对应 rank。",
|
|
41
41
|
"next": {
|
|
42
42
|
"command": "itpay services action <id> --action select_candidate --actor-type human --status approved --candidate <rank> --json",
|
|
43
43
|
"reason": "仅在用户明确选择后锁定来源候选"
|
|
@@ -65,10 +65,10 @@ itpay services next <service_execution_id> [--json]
|
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"instruction": "
|
|
68
|
+
"instruction": "付费模糊搜索已完成。现在把 items 中的编号、title 和 safe_payload 展示给用户,然后停止。本结果是 agent-visible,不要调用 read-result。若用户的目标只是搜索候选企业,任务已经完成;只有用户之后明确选择某个候选并要求继续时,才执行 next.command。不要自动购买后续报告。",
|
|
69
69
|
"next": {
|
|
70
70
|
"command": "itpay services action <id> --action select_candidate --actor-type human --status approved --candidate <rank> --json",
|
|
71
|
-
"reason": "
|
|
71
|
+
"reason": "仅在用户明确选择候选并要求继续时执行"
|
|
72
72
|
},
|
|
73
73
|
"recovery": []
|
|
74
74
|
}
|
|
@@ -119,7 +119,26 @@ itpay services next <service_execution_id> [--json]
|
|
|
119
119
|
}
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
额度耗尽或候选已确认并进入付费 continuation 时,`services next` 必须重复价格、用户确认原话、停止条件和禁止动作;普通单 Execution 的 next 使用 `services checkout`,不暴露 Quote/Cart/Buy 编排。
|
|
123
|
+
|
|
124
|
+
已有 Checkout 时,Backend 返回 `resume_checkout`,CLI 只能恢复同一 Checkout:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"status": "checkout_pending",
|
|
129
|
+
"result": {
|
|
130
|
+
"service_execution_id": "<id>",
|
|
131
|
+
"service_id": "<service_id>",
|
|
132
|
+
"phase": "checkout",
|
|
133
|
+
"allowed_actions": [{ "type": "resume_checkout", "requires_human": true }]
|
|
134
|
+
},
|
|
135
|
+
"instruction": "当前 Execution 已经有一笔 Checkout。不要创建新的 Quote、Cart、Checkout 或 Execution。现在只执行 next.command,恢复并展示同一 Checkout 的付款入口。",
|
|
136
|
+
"next": { "command": "itpay services checkout <id> --resume --json", "reason": "恢复同一 Checkout,不创建第二笔" },
|
|
137
|
+
"recovery": []
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
付款已确认但 Provider 尚在履约时只能等待并再次读取同一 Execution;不得新建 Execution、Checkout 或再次付款。其他执行阶段只返回 Execution、service、phase、类型化 `allowed_actions` 和一个服务端状态导出的命令。CLI 只把 Backend 的动作类型渲染成命令,不执行 Publication 中的任意 shell 文本。完成或空结果后不得建议重放已失效的 invoke。
|
|
123
142
|
|
|
124
143
|
## 退款访问锁
|
|
125
144
|
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
为当前 Service Execution 的一个付费 Capability 准备 Quote Lock。它只锁定可信输入、候选来源、价格、币种和有效期,不创建 Cart、Checkout、订单或 Provider 调用。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
本命令是多 Execution 合并付款的高级入口。普通单 Execution 流程应使用 `services checkout`,不要把 `services quote` 当作 Checkout 失败后的替代路径。
|
|
8
|
+
|
|
9
|
+
**上游:** 用户明确要求合并多个独立 Execution,且每个 Execution 的 Graph 当前都允许 `prepare_quote`。
|
|
8
10
|
|
|
9
11
|
**下游:** `cart add --quote`。多个独立 Execution 的 Quote 可以加入同一 Cart。
|
|
10
12
|
|
|
@@ -53,6 +55,8 @@ itpay services quote <service_execution_id> --capability <capability_id>
|
|
|
53
55
|
- `capability_input_invalid`:缺少 required input;不创建 Quote、Cart 或 Checkout。
|
|
54
56
|
- `delivery_email_required`:先说明邮箱用于交付 claim link,再询问用户;禁止代填。
|
|
55
57
|
- 候选未确认、来自其他 Execution、Quote 已存在冲突:Backend 拒绝且不改变 Execution。
|
|
58
|
+
- `service_quote_not_allowed`:当前 Graph 不允许从当前 Execution 状态购买该 capability;不得换 capability、新建 Execution 或尝试其他购买命令,只回到同一 Execution 的 `services next`。
|
|
59
|
+
- Backend 不支持当前交易合同时返回 `backend_contract_incompatible`,必须停止,不能改用 `services checkout`、`cart`、`buy` 或 `pay` 绕过。
|
|
56
60
|
|
|
57
61
|
## Agent Type / Host
|
|
58
62
|
|
|
@@ -14,7 +14,9 @@ itpay --agent-type <agent_type> services start <service_id>
|
|
|
14
14
|
[--host <host>] [--target <target>] [--json]
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
`service_id` 必须来自 Catalog。`--target` 只用于需要稳定消息目标的 Host
|
|
17
|
+
`service_id` 必须来自 Catalog。`--target` 只用于需要稳定消息目标的 Host,例如 chat/channel/open ID;它不是搜索词或其他业务输入。Buyer、Device 和 Agent instance 均来自签名 Agent session,不接受请求参数覆盖。
|
|
18
|
+
|
|
19
|
+
本命令不接收 capability 业务输入。它返回 `required_input` 和一条 `services invoke`(或其他当前合法动作)命令;把真实值填入那条命令的重复 `--input key=value`。例如企业关键词是 `--input keyword=美团`,不是 `--target 美团`。
|
|
18
20
|
|
|
19
21
|
## 标准输出
|
|
20
22
|
|
|
@@ -33,14 +35,14 @@ itpay --agent-type <agent_type> services start <service_id>
|
|
|
33
35
|
},
|
|
34
36
|
"instruction": "填写首选 capability 的 required_input;一次只提交当前 execution 所代表的服务意图。",
|
|
35
37
|
"next": {
|
|
36
|
-
"command": "itpay services invoke <execution_id> --capability <capability_id> --input <key=value> --json",
|
|
38
|
+
"command": "itpay --agent-type <agent_type> services invoke <execution_id> --capability <capability_id> --input <key=value> --json",
|
|
37
39
|
"reason": "执行当前允许的能力"
|
|
38
40
|
},
|
|
39
41
|
"recovery": []
|
|
40
42
|
}
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
Start API 只提供免费额度上限,不提供当前剩余额度,因此本命令不得虚构 `remaining`。不得输出全部 capability DTO、contract version、graph ID、buyer/device ID 或重复 guidance。若服务不存在,recovery 为 `catalog list`。设备 session
|
|
45
|
+
Start API 只提供免费额度上限,不提供当前剩余额度,因此本命令不得虚构 `remaining`。不得输出全部 capability DTO、contract version、graph ID、buyer/device ID 或重复 guidance。若服务不存在,recovery 为 `catalog list`。设备 session 由 CLI 自动登记或刷新;401 `agent_device_session_required` 仅续期并重试一次,仍失败时返回错误,不循环。
|
|
44
46
|
|
|
45
47
|
## Agent Type / Host
|
|
46
48
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# `itpay skill show`
|
|
2
|
+
|
|
3
|
+
## 范围与意义
|
|
4
|
+
|
|
5
|
+
读取 npm 包内置的完整 Agent Skill。与按 topic 渐进读取的 `docs` 不同,本命令故意一次返回完整 `SKILL.md`,用于首次 onboarding 和身份/session 规则恢复;不访问 Backend,不修改宿主配置或本地身份。
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
itpay [--agent-type <agent_type>] skill show itpay-buyer [--json]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
当前只内置 `itpay-buyer`。`--json` 时完整 Markdown 位于 `result.content`;文本模式直接输出完整内容。
|
|
12
|
+
|
|
13
|
+
未声明 Agent Type 时,`next` 是 `itpay install --json`。已声明时,`next` 是保留同一类型的 `catalog list --json`。未知名称返回 `skill_not_found`;包内文件缺失或损坏返回 `skill_unavailable` 并要求重装同版本 CLI。
|
|
14
|
+
|
|
15
|
+
Skill 是操作和安全合同,不是服务端业务状态。执行时仍以每个命令当前 envelope 的 `result`、`instruction` 和 `next` 为准。
|
|
16
|
+
|
|
17
|
+
所有 Agent Type 使用相同的 JSON 外壳、字段和命令参数。`workbuddy` 只在 `instruction` 中额外强调保持同一 Node/CLI launcher、持久写权限和减少内部诊断转述;它不改变输入或输出 schema。
|
|
@@ -25,7 +25,9 @@ CLI 输出是给 Agent 执行的协议,不是后端 DTO 的调试转储。默
|
|
|
25
25
|
- `result`:仅包含当前步骤必须使用或向用户说明的事实。
|
|
26
26
|
- `instruction`:一条可直接当作 Agent prompt 使用的自然语言指令,不复述 `result`。
|
|
27
27
|
- `next`:最多一个首选动作;流程结束时为 `null`。
|
|
28
|
+
- `next.command` 是状态机允许的首选延续,不是无条件执行指令;当前结果已满足用户目标时,Agent 应展示结果并停止。
|
|
28
29
|
- `recovery`:成功时通常为空;失败或中断时最多两个动作。
|
|
30
|
+
- 一旦命令声明 `--agent-type` 或 `ITPAY_AGENT_TYPE`,所有 ItPay `next.command` 和 `recovery.command` 都保留同一类型。
|
|
29
31
|
- 相同事实不得同时出现在顶层、`agent_guidance`、`next_actions` 等多个位置。
|
|
30
32
|
- 默认隐藏 buyer、device、contract version、compiled graph、quote lock、内部 event ID 等实现细节。
|
|
31
33
|
- token、付款 URL 和本地二维码路径只在确实需要交给用户时返回,并不得写入日志型命令。
|
|
@@ -66,6 +68,8 @@ next: <one command>
|
|
|
66
68
|
- 不得只返回 `invalid_state`;必须说明当前状态和合法恢复入口。
|
|
67
69
|
- 重试应复用同一 cart、checkout、execution、order 或 refund ID,不得默认创建新资源。
|
|
68
70
|
- 用户口头说“已付款”不是支付事实;仅服务端 `verified` 状态有效。
|
|
71
|
+
- `agent_device_session_required` 只触发一次 session 续期和同请求重试;第二次失败必须返回,不得循环或换身份。
|
|
72
|
+
- `device_state_unwritable` 表示当前运行环境不能可靠持久化 `~/.itpay-v3`;保持同一 Agent Type 与 CLI/Node launcher,恢复 Host 写权限后重试原命令,不得手工造 lock、删除身份或换运行时碰运气。
|
|
69
73
|
|
|
70
74
|
## Instruction 模板
|
|
71
75
|
|
|
@@ -91,4 +95,3 @@ Instruction 只回答当前最重要的一件事:
|
|
|
91
95
|
- 是否需要邮箱来自 `delivery_email_required`。
|
|
92
96
|
- 是否可直接给 Agent 来自 `agent_visible` / `delivery_mode`。
|
|
93
97
|
- 下一步来自 Service Execution read model,不由 CLI 猜业务流程。
|
|
94
|
-
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- [`itpay catalog`](commands/catalog/index.md)
|
|
22
22
|
- [`itpay catalog list`](commands/catalog/list.md)
|
|
23
23
|
- [`itpay install`](commands/install.md) - 查看指定 Agent 的安装说明
|
|
24
|
+
- [`itpay skill show`](commands/skill.md) - 一次读取完整内置 Buyer Skill
|
|
24
25
|
- [`itpay docs`](commands/docs/index.md)
|
|
25
26
|
- [`itpay docs list`](commands/docs/list.md)
|
|
26
27
|
- [`itpay docs show`](commands/docs/show.md)
|
package/package.json
CHANGED
|
@@ -10,16 +10,38 @@ description: >
|
|
|
10
10
|
|
|
11
11
|
Use the CLI as the only ItPay control surface. Do not recreate API calls or hardcode a service-specific sequence.
|
|
12
12
|
|
|
13
|
+
## Critical Rules
|
|
14
|
+
|
|
15
|
+
- Keep one honest Agent Type, one CLI/Node launcher, and one Host-approved permission context for the whole flow.
|
|
16
|
+
- Treat `next.command` as the preferred continuation, not an unconditional command. If the current result already satisfies the user's stated goal, present it and stop.
|
|
17
|
+
- Keep internal parsing, retries, sandbox diagnosis, and command translation out of the user response; report useful progress, results, and real human decisions only.
|
|
18
|
+
- If Device state is not writable, stop. Do not switch Node, manually create lock files, delete identity, or rotate Agent Type.
|
|
19
|
+
|
|
13
20
|
## Bootstrap
|
|
14
21
|
|
|
15
22
|
```bash
|
|
16
23
|
npm install -g @itpay/cli
|
|
24
|
+
itpay readyz --json
|
|
25
|
+
itpay skill show itpay-buyer --json
|
|
26
|
+
itpay install --json
|
|
17
27
|
itpay install <agent_type> --json
|
|
18
28
|
itpay --agent-type <agent_type> readyz --json
|
|
19
|
-
itpay --agent-type <agent_type> docs show quickstart --json
|
|
20
29
|
```
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
Follow each returned `next.command`. `readyz` deliberately points back to this complete Skill. If the Skill was read without an Agent Type, choose the real runtime with `install`; after typed `readyz`, read the Skill again and continue to Catalog.
|
|
32
|
+
|
|
33
|
+
Supported types are `codex-desktop`, `codex-cli`, `claude-code-desktop`, `claude-code-cli`, and `workbuddy`. State the real stable runtime type honestly. Do not identify a window, chat, task, process, or model session as a new Agent.
|
|
34
|
+
|
|
35
|
+
## Identity And Sessions
|
|
36
|
+
|
|
37
|
+
- One local Ed25519 private key represents this ItPay installation. Never expose, copy, or rotate it to recover quota.
|
|
38
|
+
- Device registrations are scoped by exact Backend API base URL. `dev`, `test`, and `app` therefore have separate server device IDs, quota lineage, Agent instances, and sessions while using the same local key.
|
|
39
|
+
- Each Backend registration has one Agent Instance per `agent_type`. Different windows and chats of the same type reuse it; different types get separate instances under that registration.
|
|
40
|
+
- Every commerce command must keep the explicit `--agent-type` returned in `next` and `recovery`, or use one stable `ITPAY_AGENT_TYPE`. Never fall back to another type previously used on the machine.
|
|
41
|
+
- The CLI renews an expired or rejected device session and retries the same request exactly once. If that retry still fails, stop and report it; do not loop, create a new identity, or switch Agent Type.
|
|
42
|
+
- A revoked v2 device is not replaced automatically. It requires an explicit operator recovery path.
|
|
43
|
+
- If an operator confirms that one Backend registration database was reset, use `device recover --confirm-backend-reset` for that selected Backend only. This preserves the private key and every other Backend registration; never use it for ordinary session expiry or revocation.
|
|
44
|
+
- `--host` selects presentation. `--target` is only the destination chat/channel/open ID required by some Hosts. Neither is business input or identity.
|
|
23
45
|
|
|
24
46
|
## Envelope Rule
|
|
25
47
|
|
|
@@ -41,17 +63,20 @@ itpay --agent-type <agent_type> services start <service_id> --json
|
|
|
41
63
|
|
|
42
64
|
Then execute the exact `next.command` returned by each step. It may invoke a capability, ask for a selection, create a Checkout, wait for human action, return an Agent-visible result, or read a protected result after grant.
|
|
43
65
|
|
|
66
|
+
`services start` creates the Execution and returns the preferred capability plus its `required_input`. Put business values only in repeated `--input key=value` options on the returned `services invoke`, `services quote`, or `services checkout` command. For example, a company keyword belongs in `--input keyword=美团`; it never belongs in `--target`.
|
|
67
|
+
|
|
44
68
|
Rules:
|
|
45
69
|
|
|
46
70
|
- One independent service intent uses one Service Execution.
|
|
47
71
|
- Every candidate list belongs to its source Service Execution. After a human selects a rank, submit the selection on that same Execution; never copy it into a new Execution or construct a candidate.
|
|
48
|
-
- A paid step
|
|
49
|
-
- `services
|
|
72
|
+
- A normal single-Execution paid step uses the exact `services checkout` command returned by the CLI, but only after the instruction has made the price visible and the human explicitly agrees. The command internally uses the same Quote, Cart and Checkout rules.
|
|
73
|
+
- `services quote -> cart add --quote -> buy --cart` is only for a human who explicitly asks to combine Quotes from multiple independent Executions. Never use it as a fallback when `services checkout` fails.
|
|
50
74
|
- Ask for required email/contact fields; explain their delivery purpose and never invent them.
|
|
51
|
-
- When Checkout is ready, make
|
|
75
|
+
- When Checkout is ready, make the amount, ItPay QR/image and URL visible on the current human surface, then stop. Do not query until the human completes the action or asks for status.
|
|
52
76
|
- Normal payment happens on the ItPay Checkout page. `itpay pay` and `buy --pay` are operator escape hatches.
|
|
53
77
|
- Payment is confirmed only by Backend Checkout or Order state.
|
|
54
78
|
- Agent-visible results come from `services next`; do not call `read-result` for them.
|
|
79
|
+
- Quota exhaustion, candidate selection, Checkout pending, payment verified and delivery each remain on the same Execution. Never create a replacement Execution to escape one of those states.
|
|
55
80
|
- An Execution may have delivery history; always follow `services next` for the backend-selected current delivery instead of reusing an older result.
|
|
56
81
|
- Protected results require a current human grant. The grant is scoped to one delivery, approved fields and frozen Agent audience, and expires after 15 minutes.
|
|
57
82
|
- A pending refund locks every delivery path and revokes existing grants.
|
|
@@ -65,8 +90,9 @@ itpay --agent-type <agent_type> next --json
|
|
|
65
90
|
itpay --agent-type <agent_type> services list --json
|
|
66
91
|
itpay --agent-type <agent_type> services next <service_execution_id> --json
|
|
67
92
|
itpay --agent-type <agent_type> services checkout <service_execution_id> --resume --json
|
|
68
|
-
itpay checkout --id <checkout_id> --token <display_token> --json
|
|
93
|
+
itpay --agent-type <agent_type> checkout --id <checkout_id> --token <display_token> --json
|
|
69
94
|
itpay --agent-type <agent_type> refund get <refund_request_id> --json
|
|
95
|
+
itpay --agent-type <agent_type> device recover --confirm-backend-reset --json
|
|
70
96
|
```
|
|
71
97
|
|
|
72
98
|
## Safety
|
|
@@ -83,6 +109,7 @@ itpay --agent-type <agent_type> refund get <refund_request_id> --json
|
|
|
83
109
|
itpay docs list --json
|
|
84
110
|
itpay docs search <term> --json
|
|
85
111
|
itpay docs show <topic> --json
|
|
112
|
+
itpay skill show itpay-buyer --json
|
|
86
113
|
```
|
|
87
114
|
|
|
88
115
|
The normative command contracts are packaged under `docs/cli-reference`.
|