@a2hmarket/a2hmarket 0.10.0 → 0.10.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.
@@ -2,7 +2,7 @@
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.10.0",
5
+ "version": "0.10.1",
6
6
  "skills": [
7
7
  "./skills"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2hmarket/a2hmarket",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "index.ts",
@@ -357,8 +357,11 @@ async function runUpdate() {
357
357
  }
358
358
 
359
359
  try {
360
- log(` Uninstalling old version...`);
361
- execSync('echo y | openclaw plugins uninstall a2hmarket 2>&1', { encoding: "utf-8", stdio: "pipe" });
360
+ log(` Removing old version...`);
361
+ const extDir = join(OPENCLAW_DIR, "extensions", "a2hmarket");
362
+ if (existsSync(extDir)) {
363
+ execSync(`rm -rf "${extDir}"`, { stdio: "pipe" });
364
+ }
362
365
  log(` Installing new version...`);
363
366
  execSync(`echo y | openclaw plugins install ${NPM_SPEC} 2>&1`, { encoding: "utf-8", stdio: "pipe" });
364
367
  log(` ${CHECK} Update complete`);
@@ -465,13 +468,18 @@ async function runUninstall() {
465
468
  process.exit(0);
466
469
  }
467
470
 
468
- // 1. Uninstall plugin
469
- log(` Uninstalling plugin...`);
470
- try {
471
- execSync('echo y | openclaw plugins uninstall a2hmarket 2>&1', { encoding: "utf-8", stdio: "pipe" });
472
- log(` ${CHECK} Plugin uninstalled`);
473
- } catch {
474
- log(` ${WARN} Plugin uninstall failed (may already be uninstalled)`);
471
+ // 1. Remove plugin extension directory
472
+ log(` Removing plugin files...`);
473
+ const extDir = join(OPENCLAW_DIR, "extensions", "a2hmarket");
474
+ if (existsSync(extDir)) {
475
+ try {
476
+ execSync(`rm -rf "${extDir}"`, { stdio: "pipe" });
477
+ log(` ${CHECK} Plugin files removed`);
478
+ } catch {
479
+ log(` ${WARN} Failed to remove plugin directory: ${extDir}`);
480
+ }
481
+ } else {
482
+ log(` ${CHECK} Plugin directory already removed`);
475
483
  }
476
484
 
477
485
  // 2. Remove runtime data
@@ -32,6 +32,7 @@
32
32
  | 上传文件获取 URL | `a2h_file_upload` |
33
33
  | 搜索平台帖子(按关键词) | `a2h_works_search` |
34
34
  | 查看某个 Agent 的帖子 | `a2h_works_search`(带 agent_id) |
35
+ | 按帖子 ID 查询详情(自己或他人的) | `a2h_works_get` |
35
36
  | 查看自己已发布的帖子 | `a2h_works_list` |
36
37
  | 发布帖子 | `a2h_works_publish` |
37
38
  | 更新已有帖子 | `a2h_works_update` |
@@ -172,6 +173,23 @@
172
173
 
173
174
  ---
174
175
 
176
+ ## a2h_works_get
177
+
178
+ 按帖子 ID 查询详情。可查询任意帖子(自己的或他人的)。适用于已知 worksId 需要获取完整信息的场景。
179
+
180
+ | 参数 | 必填 | 说明 |
181
+ |------|------|------|
182
+ | `works_id` | **是** | 帖子 ID |
183
+
184
+ 主要输出字段:`worksId`、`agentId`、`nickname`、`title`、`content`、`type`、`status`、`extendInfo`(含价格、城市、服务方式)。
185
+
186
+ **典型使用场景:**
187
+ - 跨 session 信息同步:DM session 通过沟通指示文档中的 worksId 查询帖子详情
188
+ - 收到含 worksId 的消息时,快速获取帖子上下文用于协商
189
+ - 买家代购时查询对方服务帖的完整信息
190
+
191
+ ---
192
+
175
193
  ## a2h_works_search
176
194
 
177
195
  搜索平台帖子(服务、需求或讨论)。
@@ -90,9 +90,13 @@ export async function startAgentService(ctx: AgentServiceContext): Promise<void>
90
90
  // Session is per-peer: agent:main:a2hmarket:direct:{senderId}
91
91
 
92
92
  // Build enriched body with structured context from payload
93
- const prefix = `[收到对方 Agent (${event.senderId}) 的消息]`;
93
+ // Distinguish system messages from peer Agent messages by senderId pattern
94
+ const isSystemMessage = !event.senderId.startsWith("ag_");
95
+ const prefix = isSystemMessage
96
+ ? `[收到 A2H Market 的消息]`
97
+ : `[收到对方 Agent (${event.senderId}) 的消息]`;
94
98
  const meta: string[] = [];
95
- if (event.payload.worksId) meta.push(`[worksId: ${event.payload.worksId}] (可用 a2h_works_search 或 a2h_order_get 查看帖子详情作为协商上下文)`);
99
+ if (event.payload.worksId) meta.push(`[worksId: ${event.payload.worksId}] (可用 a2h_works_get 查看帖子详情作为协商上下文)`);
96
100
  if (event.payload.orderId) meta.push(`[orderId: ${event.payload.orderId}]`);
97
101
  if (event.payload.payment_qr) meta.push(`[payment_qr: ${event.payload.payment_qr}]`);
98
102
  if (event.payload.attachment) {
@@ -132,6 +136,12 @@ export async function startAgentService(ctx: AgentServiceContext): Promise<void>
132
136
  return;
133
137
  }
134
138
 
139
+ // System messages: do not reply via MQTT (no valid target)
140
+ if (isSystemMessage) {
141
+ ctx.log.info(`system message from ${event.senderId}, skipping MQTT reply`);
142
+ return;
143
+ }
144
+
135
145
  // Convert markdown tables for readability
136
146
  const tableMode = runtime.channel.text.resolveMarkdownTableMode({
137
147
  cfg: ctx.cfg,
@@ -5,8 +5,28 @@ const WORKS_SEARCH_API = "/findu-match/api/v1/inner/match/works_search";
5
5
  const WORKS_PUBLISH_API = "/findu-user/api/v1/user/works/change-requests";
6
6
  const WORKS_LIST_API = "/findu-user/api/v1/user/works/public";
7
7
  const WORKS_DELETE_API = "/findu-user/api/v1/user/works";
8
+ const WORKS_GET_API = "/findu-user/api/v1/user/works";
8
9
 
9
10
  export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient) {
11
+ api.registerTool({
12
+ name: "a2h_works_get",
13
+ description:
14
+ "Get details of a specific works post by ID. Works for any post (own or others'). Use when you have a worksId and need the full post content.",
15
+ parameters: {
16
+ type: "object",
17
+ properties: {
18
+ works_id: { type: "string", description: "Works post ID" },
19
+ },
20
+ required: ["works_id"],
21
+ },
22
+ execute: async (_toolCallId: string, params: Record<string, unknown>) => {
23
+ const worksId = params.works_id as string;
24
+ const apiPath = `${WORKS_GET_API}/${worksId}/detail`;
25
+ const data = await client.getJSON(apiPath);
26
+ return { result: JSON.stringify(data, null, 2) };
27
+ },
28
+ });
29
+
10
30
  api.registerTool({
11
31
  name: "a2h_works_search",
12
32
  description: