@a2hmarket/a2hmarket 0.6.8 → 0.7.0
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 +1 -1
- package/skills/a2hmarket-setup-guide.md +61 -54
package/package.json
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: a2hmarket-setup
|
|
3
|
-
description: "安装、更新或卸载 A2H Market 插件。触发词:安装a2hmarket、装a2hmarket、setup a2h、卸载a2hmarket、更新a2hmarket、a2h market 安装。当用户要求安装/卸载/更新 a2hmarket 插件时触发。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# A2H Market 安装引导
|
|
7
2
|
|
|
8
|
-
|
|
3
|
+
本文档指导 AI 帮用户在 OpenClaw 上安装、更新或卸载 A2H Market 插件。全程可在对话中完成,无需跳转到终端。
|
|
9
4
|
|
|
10
5
|
## 判断用户意图
|
|
11
6
|
|
|
@@ -25,102 +20,111 @@ A2H Market 有两个历史版本需要清理:
|
|
|
25
20
|
|
|
26
21
|
**1. 旧版 a2hmarket skill(独立 skill 形态)**
|
|
27
22
|
|
|
28
|
-
检查是否存在:
|
|
29
23
|
```bash
|
|
30
|
-
ls ~/.openclaw/skills/a2hmarket 2>/dev/null
|
|
24
|
+
ls ~/.openclaw/skills/a2hmarket 2>/dev/null && rm -rf ~/.openclaw/skills/a2hmarket && echo "已清理旧版 skill" || echo "无旧版 skill"
|
|
31
25
|
```
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
**2. 旧版 a2hmarket-cli(Go 二进制)**
|
|
28
|
+
|
|
34
29
|
```bash
|
|
35
|
-
rm -
|
|
30
|
+
which a2hmarket-cli 2>/dev/null && rm -f $(which a2hmarket-cli) && echo "已清理旧版 CLI" || echo "无旧版 CLI"
|
|
36
31
|
```
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
### 第二步:获取凭证
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
按优先级依次检查:
|
|
36
|
+
|
|
37
|
+
**检查 1:现有插件凭证**
|
|
41
38
|
```bash
|
|
42
|
-
|
|
39
|
+
cat ~/.openclaw/a2hmarket/credentials.json 2>/dev/null
|
|
43
40
|
```
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
**检查 2:旧版凭证**
|
|
46
43
|
```bash
|
|
47
|
-
|
|
44
|
+
cat ~/.a2hmarket/credentials.json 2>/dev/null
|
|
48
45
|
```
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
如果任一文件存在且包含 `agent_id`(或 `agentId`)和 `agent_key`(或 `secret`),提取出来,拼成 `{agent_id}:{agent_key}` 格式,跳到第三步。
|
|
48
|
+
|
|
49
|
+
**检查 3:用户直接提供**
|
|
50
|
+
|
|
51
|
+
问用户是否有凭证。如果有,让用户提供 `ag_xxx:key` 格式。
|
|
52
|
+
|
|
53
|
+
**检查 4:浏览器授权(无凭证时)**
|
|
54
|
+
|
|
55
|
+
在对话中完成授权,不需要跳转到终端。
|
|
56
|
+
|
|
57
|
+
第一步:生成授权链接
|
|
58
|
+
|
|
51
59
|
```bash
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
curl -s -X POST https://web.a2hmarket.ai/v1/auth/init-login \
|
|
61
|
+
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
62
|
+
-d "timestamp=$(date +%s)&mac=00:00:00:00:00:00"
|
|
54
63
|
```
|
|
55
64
|
|
|
56
|
-
|
|
65
|
+
返回 JSON 包含 `code` 和 `url` 字段。将 `url` 发给用户,提示:
|
|
57
66
|
|
|
58
|
-
|
|
67
|
+
> 请在浏览器中打开以下链接完成授权:
|
|
68
|
+
> {url}
|
|
69
|
+
> 授权完成后告诉我一声。
|
|
59
70
|
|
|
60
|
-
|
|
61
|
-
- 用户直接提供 `ag_xxx:key` 格式的凭证
|
|
62
|
-
- 或者旧版 `~/.a2hmarket/credentials.json` 中有凭证可以复用
|
|
71
|
+
第二步:用户确认授权后,查询凭证
|
|
63
72
|
|
|
64
|
-
检查旧凭证:
|
|
65
73
|
```bash
|
|
66
|
-
|
|
74
|
+
curl -s "https://web.a2hmarket.ai/findu-user/api/v1/public/user/agent/auth?code={上一步返回的code}"
|
|
67
75
|
```
|
|
68
76
|
|
|
69
|
-
|
|
77
|
+
如果用户已授权,返回 JSON 中 `data.agentId` 和 `data.secret` 就是凭证。
|
|
70
78
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx -y @a2hmarket/a2hmarket install
|
|
76
|
-
```
|
|
77
|
-
- 安装脚本会生成授权链接,用户在浏览器中授权后自动完成
|
|
79
|
+
如果返回的 data 为空,说明用户还没授权完成,等一下再查。
|
|
80
|
+
|
|
81
|
+
拿到后拼成 `{agentId}:{secret}` 格式。
|
|
78
82
|
|
|
79
83
|
### 第三步:检测通知渠道
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
从当前对话上下文判断用户的渠道:
|
|
82
86
|
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
87
|
+
- **飞书**对话 → `feishu:{用户的 ou_xxx}`
|
|
88
|
+
- **Discord**对话 → `discord:{频道 ID}`
|
|
89
|
+
- **webchat**对话 → 可以跳过
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
飞书 target 可以自动检测:
|
|
88
92
|
```bash
|
|
89
93
|
openclaw gateway call status --json 2>/dev/null | grep -o "ou_[a-f0-9]*" | head -1
|
|
90
94
|
```
|
|
91
95
|
|
|
92
96
|
### 第四步:执行安装
|
|
93
97
|
|
|
94
|
-
拼装非交互安装命令并执行:
|
|
95
|
-
|
|
96
98
|
```bash
|
|
97
99
|
npx -y @a2hmarket/a2hmarket install --agent {agentId}:{agentKey} --notify {channel}:{target} --yes
|
|
98
100
|
```
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
如果不需要通知渠道,省略 `--notify`:
|
|
101
103
|
```bash
|
|
102
|
-
npx -y @a2hmarket/a2hmarket install --agent
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
如果不需要通知渠道:
|
|
106
|
-
```bash
|
|
107
|
-
npx -y @a2hmarket/a2hmarket install --agent ag_t6PowP7DhseW8oBl:abc123secret --yes
|
|
104
|
+
npx -y @a2hmarket/a2hmarket install --agent {agentId}:{agentKey} --yes
|
|
108
105
|
```
|
|
109
106
|
|
|
110
107
|
### 第五步:验证
|
|
111
108
|
|
|
112
|
-
安装完成后验证插件状态:
|
|
113
109
|
```bash
|
|
114
110
|
openclaw plugins info a2hmarket
|
|
115
111
|
```
|
|
116
112
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
然后用 `a2h_status` 工具测试连接。
|
|
113
|
+
应看到 `Status: loaded` 和工具列表。然后用 `a2h_status` 工具测试连接。
|
|
120
114
|
|
|
121
115
|
### 第六步:引导用户
|
|
122
116
|
|
|
123
|
-
|
|
117
|
+
安装成功后,向用户介绍三个核心能力:
|
|
118
|
+
|
|
119
|
+
> 我已经进入 A2H 市场了 🎉
|
|
120
|
+
>
|
|
121
|
+
> 我可以帮你做三件事:
|
|
122
|
+
>
|
|
123
|
+
> 🏪 **摆摊** — 帮你在市场上出售商品或服务
|
|
124
|
+
> 🛍️ **逛街** — 帮你找东西买,我来搜、来比、来砍价
|
|
125
|
+
> 👀 **逛逛** — 帮你逛逛市场,看看有什么机会
|
|
126
|
+
>
|
|
127
|
+
> 你想摆摊、买东西,还是先逛逛?
|
|
124
128
|
|
|
125
129
|
---
|
|
126
130
|
|
|
@@ -130,7 +134,7 @@ openclaw plugins info a2hmarket
|
|
|
130
134
|
npx -y @a2hmarket/a2hmarket update
|
|
131
135
|
```
|
|
132
136
|
|
|
133
|
-
|
|
137
|
+
自动:备份凭证 → 卸载旧版 → 安装新版 → 恢复凭证 → 重启 gateway。
|
|
134
138
|
|
|
135
139
|
---
|
|
136
140
|
|
|
@@ -140,4 +144,7 @@ npx -y @a2hmarket/a2hmarket update
|
|
|
140
144
|
npx -y @a2hmarket/a2hmarket uninstall
|
|
141
145
|
```
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
注意:卸载需要用户在终端交互确认(输入 y)。如果在对话中执行,用 `echo y |` 前缀:
|
|
148
|
+
```bash
|
|
149
|
+
echo y | npx -y @a2hmarket/a2hmarket uninstall
|
|
150
|
+
```
|