@a2hmarket/a2hmarket 0.7.5 → 0.7.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/openclaw.plugin.json +4 -2
- package/package.json +1 -1
- package/scripts/install.mjs +46 -18
package/openclaw.plugin.json
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
"id": "a2hmarket",
|
|
3
3
|
"name": "A2H Market",
|
|
4
4
|
"description": "A2H Market — AI agent marketplace with self-managed A2A messaging via MQTT.",
|
|
5
|
-
"version": "0.
|
|
6
|
-
"skills": [
|
|
5
|
+
"version": "0.7.7",
|
|
6
|
+
"skills": [
|
|
7
|
+
"./skills"
|
|
8
|
+
],
|
|
7
9
|
"configSchema": {
|
|
8
10
|
"type": "object",
|
|
9
11
|
"properties": {},
|
package/package.json
CHANGED
package/scripts/install.mjs
CHANGED
|
@@ -188,36 +188,63 @@ async function getFeishuToken(appId, appSecret) {
|
|
|
188
188
|
return data.tenant_access_token;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
"
|
|
198
|
-
"
|
|
191
|
+
function isZhLocale() {
|
|
192
|
+
const lang = (process.env.LANG || process.env.LC_ALL || process.env.LANGUAGE || "").toLowerCase();
|
|
193
|
+
return lang.startsWith("zh");
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const ONBOARDING_ZH = {
|
|
197
|
+
title: "🎉 A2H Market · 安装成功",
|
|
198
|
+
intro: "我已经进入 A2H 市场了!这边特别热闹,很多人在摆摊出售各种东西,也有很多人在挑选商品和讨价还价。",
|
|
199
|
+
subtitle: "我可以帮你做三件事:",
|
|
200
|
+
items:
|
|
201
|
+
"🏪 **摆摊** — 帮你在市场上出售商品或服务,也可以直接接别人的悬赏任务赚钱\n\n" +
|
|
202
|
+
"🛍️ **逛街** — 帮你在市场上找东西买,我来搜、来比、来砍价,你拍板就行\n\n" +
|
|
203
|
+
"👀 **逛逛** — 还没想好也没关系!我帮你逛逛市场,看看有什么赚钱机会或者值得买的好东西",
|
|
204
|
+
cta: "你是想**摆摊卖东西**、**买点什么**,还是先让我帮你**逛逛**看看有什么机会?",
|
|
205
|
+
agent: (id) => `我的A2H Agent: ${id}`,
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const ONBOARDING_EN = {
|
|
209
|
+
title: "🎉 A2H Market · Setup Complete",
|
|
210
|
+
intro: "I'm now connected to A2H Market! The marketplace is buzzing with activity.",
|
|
211
|
+
subtitle: "I can help you with three things:",
|
|
212
|
+
items:
|
|
213
|
+
"🏪 **Sell** — List your products or services on the marketplace, or take on bounty tasks\n\n" +
|
|
214
|
+
"🛍️ **Shop** — Find and buy what you need — I'll search, compare, and negotiate for you\n\n" +
|
|
215
|
+
"👀 **Explore** — Not sure yet? I'll browse the market and discover opportunities for you",
|
|
216
|
+
cta: "Would you like to **sell something**, **buy something**, or just **explore** the market?",
|
|
217
|
+
agent: (id) => `My A2H Agent: ${id}`,
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
function getOnboardingLocale() {
|
|
221
|
+
return isZhLocale() ? ONBOARDING_ZH : ONBOARDING_EN;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function getOnboardingText() {
|
|
225
|
+
const t = getOnboardingLocale();
|
|
226
|
+
return `${t.title}\n\n${t.intro}\n\n${t.subtitle}\n\n${t.items}\n\n${t.cta}`;
|
|
227
|
+
}
|
|
199
228
|
|
|
200
229
|
async function sendOnboardingFeishu(appId, appSecret, target, agentId) {
|
|
201
230
|
const token = await getFeishuToken(appId, appSecret);
|
|
202
231
|
const receiveIdType = target.startsWith("oc_") ? "chat_id" : "open_id";
|
|
232
|
+
const t = getOnboardingLocale();
|
|
203
233
|
|
|
204
234
|
const card = {
|
|
205
235
|
schema: "2.0",
|
|
206
236
|
config: { wide_screen_mode: true },
|
|
207
237
|
header: {
|
|
208
|
-
title: { tag: "plain_text", content:
|
|
238
|
+
title: { tag: "plain_text", content: t.title },
|
|
209
239
|
template: "green",
|
|
210
240
|
},
|
|
211
241
|
body: {
|
|
212
242
|
elements: [
|
|
213
|
-
{ tag: "markdown", content:
|
|
214
|
-
{ tag: "markdown", content:
|
|
215
|
-
{ tag: "markdown", content:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
"👀 **Explore** — Not sure yet? I'll browse the market and discover opportunities for you" },
|
|
219
|
-
{ tag: "markdown", content: "Would you like to **sell something**, **buy something**, or just **explore** the market?" },
|
|
220
|
-
{ tag: "markdown", content: `---\n*My A2H Agent: ${agentId}*` },
|
|
243
|
+
{ tag: "markdown", content: t.intro },
|
|
244
|
+
{ tag: "markdown", content: t.subtitle },
|
|
245
|
+
{ tag: "markdown", content: t.items },
|
|
246
|
+
{ tag: "markdown", content: t.cta },
|
|
247
|
+
{ tag: "markdown", content: `---\n*${t.agent(agentId)}*` },
|
|
221
248
|
],
|
|
222
249
|
},
|
|
223
250
|
};
|
|
@@ -232,7 +259,8 @@ async function sendOnboardingFeishu(appId, appSecret, target, agentId) {
|
|
|
232
259
|
}
|
|
233
260
|
|
|
234
261
|
async function sendOnboardingDiscord(botToken, channelId, agentId) {
|
|
235
|
-
const
|
|
262
|
+
const t = getOnboardingLocale();
|
|
263
|
+
const text = getOnboardingText() + `\n\n---\n_${t.agent(agentId)}_`;
|
|
236
264
|
const resp = await fetch(`https://discord.com/api/v10/channels/${channelId}/messages`, {
|
|
237
265
|
method: "POST",
|
|
238
266
|
headers: { "Content-Type": "application/json", Authorization: `Bot ${botToken}` },
|