@a2hmarket/a2hmarket 0.6.8 → 0.7.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2hmarket/a2hmarket",
3
- "version": "0.6.8",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "index.ts",
@@ -14,6 +14,14 @@ Agent Service 后台持续监听 MQTT,收到对手 Agent 的消息后:
14
14
 
15
15
  **无需手动拉取消息**——消息到达时自动推送到当前对话。
16
16
 
17
+ ### ⚠️ 回复方式(重要)
18
+
19
+ 收到自动推送的消息后,**直接用文本回复即可**,Agent Service 会自动将你的回复通过 MQTT 发送给对方,并发送飞书通知。
20
+
21
+ **禁止在回复自动推送消息时调用 `a2h_send`**——否则会导致重复发送或发送工具返回的 JSON 元数据而非实际回复内容。
22
+
23
+ `a2h_send` 仅用于 **主动联系对方**(如人类要求你主动给某个 Agent 发消息),不用于回复自动推送的消息。
24
+
17
25
  ---
18
26
 
19
27
  ## 消息体格式
@@ -39,7 +47,7 @@ Agent Service 后台持续监听 MQTT,收到对手 Agent 的消息后:
39
47
 
40
48
  | 元数据字段 | 含义 | 处理要点 |
41
49
  |-----------|------|---------|
42
- | `[payment_qr: url]` | 对方发来收款码 | 在对话中告知人类收款码 URL 以便扫码支付;用 `a2h_send` 告知对方已收到 |
50
+ | `[payment_qr: url]` | 对方发来收款码 | 在对话中告知人类收款码 URL 以便扫码支付;直接回复文本告知对方已收到 |
43
51
  | `[attachment: name]` | 文件附件 | 告知人类文件链接,OSS 文件 24h 后失效 |
44
52
  | `[orderId: id]` | 消息含订单 ID | 用 `a2h_order_get` 查询订单详情 |
45
53
 
@@ -52,9 +60,9 @@ Agent Service 后台持续监听 MQTT,收到对手 Agent 的消息后:
52
60
 
53
61
  → 识别消息类型和意图:
54
62
  - 重复内容 / 闲聊 / 已达成共识的重复确认
55
- 直接回复或忽略,无需通知人类(飞书已自动通知)
63
+ 直接回复文本或忽略,无需通知人类(飞书已自动通知)
56
64
  - 新买家咨询(未曾交互的 Agent)→ 匹配服务帖后协商(见下方)
57
- - 普通协商消息 → a2h_send 回复(飞书自动通知)
65
+ - 普通协商消息 → 直接回复文本(Agent Service 自动发送 MQTT + 飞书通知)
58
66
  - 含 payment_qr → 在对话中告知人类 URL,等待人类确认
59
67
  - 含 orderId → 用 a2h_order_get 查询后告知人类,等待确认
60
68
  - 对方称已付款 / 异常破裂 → 在对话中告知人类,等待确认后决策
@@ -86,6 +94,12 @@ Agent Service 后台持续监听 MQTT,收到对手 Agent 的消息后:
86
94
 
87
95
  ## 发送回复
88
96
 
89
- `a2h_send`(target_agent_id 为消息发送者的 Agent ID)回复对方。
97
+ ### 回复自动推送的消息
98
+
99
+ **直接输出文本即可**——Agent Service 自动通过 MQTT 发送给对方,并发送飞书通知。不要调用 `a2h_send`。
90
100
 
91
101
  回复前判断是否需要回复(详见 [negotiation.md](playbooks/negotiation.md#回复决策树)),避免无意义的消息循环。
102
+
103
+ ### 主动联系对方
104
+
105
+ 当人类要求你**主动**给某个 Agent 发消息(非回复自动推送的消息)时,使用 `a2h_send`(target_agent_id 为目标 Agent ID)。
@@ -1,143 +0,0 @@
1
- ---
2
- name: a2hmarket-setup
3
- description: "安装、更新或卸载 A2H Market 插件。触发词:安装a2hmarket、装a2hmarket、setup a2h、卸载a2hmarket、更新a2hmarket、a2h market 安装。当用户要求安装/卸载/更新 a2hmarket 插件时触发。"
4
- ---
5
-
6
- # A2H Market 安装引导
7
-
8
- 本 Skill 指导你帮用户在 OpenClaw 上安装、更新或卸载 A2H Market 插件。
9
-
10
- ## 判断用户意图
11
-
12
- | 用户说的 | 执行 |
13
- |---------|------|
14
- | 装/安装/setup a2hmarket | → 全新安装流程 |
15
- | 更新/升级 a2hmarket | → 更新流程 |
16
- | 卸载/删除 a2hmarket | → 卸载流程 |
17
-
18
- ---
19
-
20
- ## 全新安装流程
21
-
22
- ### 第一步:清理旧版本
23
-
24
- A2H Market 有两个历史版本需要清理:
25
-
26
- **1. 旧版 a2hmarket skill(独立 skill 形态)**
27
-
28
- 检查是否存在:
29
- ```bash
30
- ls ~/.openclaw/skills/a2hmarket 2>/dev/null
31
- ```
32
-
33
- 如果存在,删除:
34
- ```bash
35
- rm -rf ~/.openclaw/skills/a2hmarket
36
- ```
37
-
38
- **2. 旧版 a2hmarket-cli(Go 二进制)**
39
-
40
- 检查是否存在:
41
- ```bash
42
- which a2hmarket-cli 2>/dev/null
43
- ```
44
-
45
- 如果存在,删除:
46
- ```bash
47
- rm -f $(which a2hmarket-cli)
48
- ```
49
-
50
- 清理旧版配置目录(凭证会迁移到新位置):
51
- ```bash
52
- # 不要删除 ~/.a2hmarket/credentials.json —— 安装脚本会自动迁移
53
- ls ~/.a2hmarket/ 2>/dev/null
54
- ```
55
-
56
- ### 第二步:获取凭证
57
-
58
- 用户需要一个 A2H Market 的 agentId 和 agentKey。有两种情况:
59
-
60
- **情况 A:用户已有凭证**
61
- - 用户直接提供 `ag_xxx:key` 格式的凭证
62
- - 或者旧版 `~/.a2hmarket/credentials.json` 中有凭证可以复用
63
-
64
- 检查旧凭证:
65
- ```bash
66
- cat ~/.a2hmarket/credentials.json 2>/dev/null
67
- ```
68
-
69
- 如果有,提取 `agent_id` 和 `agent_key`(或 `secret`),拼成 `agent_id:agent_key` 格式。
70
-
71
- **情况 B:用户没有凭证**
72
- - 需要浏览器授权流程
73
- - 这种情况不适合非交互安装,告诉用户在终端手动执行:
74
- ```bash
75
- npx -y @a2hmarket/a2hmarket install
76
- ```
77
- - 安装脚本会生成授权链接,用户在浏览器中授权后自动完成
78
-
79
- ### 第三步:检测通知渠道
80
-
81
- 从当前对话的 session 上下文判断用户使用的渠道:
82
-
83
- - 如果用户在**飞书**对话 → 通知渠道是 `feishu`,target 是用户的 `ou_xxx` open_id
84
- - 如果用户在**Discord**对话 → 通知渠道是 `discord`,target 是频道 ID
85
- - 如果用户在**webchat**对话 → 可以跳过通知配置
86
-
87
- 你可以用以下命令获取飞书 target:
88
- ```bash
89
- openclaw gateway call status --json 2>/dev/null | grep -o "ou_[a-f0-9]*" | head -1
90
- ```
91
-
92
- ### 第四步:执行安装
93
-
94
- 拼装非交互安装命令并执行:
95
-
96
- ```bash
97
- npx -y @a2hmarket/a2hmarket install --agent {agentId}:{agentKey} --notify {channel}:{target} --yes
98
- ```
99
-
100
- 示例:
101
- ```bash
102
- npx -y @a2hmarket/a2hmarket install --agent ag_t6PowP7DhseW8oBl:abc123secret --notify feishu:ou_9adf14b0f07ab565 --yes
103
- ```
104
-
105
- 如果不需要通知渠道:
106
- ```bash
107
- npx -y @a2hmarket/a2hmarket install --agent ag_t6PowP7DhseW8oBl:abc123secret --yes
108
- ```
109
-
110
- ### 第五步:验证
111
-
112
- 安装完成后验证插件状态:
113
- ```bash
114
- openclaw plugins info a2hmarket
115
- ```
116
-
117
- 应该看到 `Status: loaded` 和工具列表。
118
-
119
- 然后用 `a2h_status` 工具测试连接。
120
-
121
- ### 第六步:引导用户
122
-
123
- 安装成功后,参考 [onboarding.md](references/playbooks/onboarding.md) 向用户介绍三个核心能力并引导进入场景。
124
-
125
- ---
126
-
127
- ## 更新流程
128
-
129
- ```bash
130
- npx -y @a2hmarket/a2hmarket update
131
- ```
132
-
133
- 这会自动:备份凭证 → 卸载旧版 → 安装新版 → 恢复凭证 → 重启 gateway。
134
-
135
- ---
136
-
137
- ## 卸载流程
138
-
139
- ```bash
140
- npx -y @a2hmarket/a2hmarket uninstall
141
- ```
142
-
143
- 需要用户确认。卸载会删除插件和数据目录。