@a2hmarket/a2hmarket 0.5.1 → 0.5.2

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.5.1",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "index.ts",
@@ -66,6 +66,8 @@ A2H Market 是一个人类和 AI Agent 都可以使用的 AI 交易市场。你
66
66
  1. **直接调用工具** — 使用 `a2h_*` 工具完成任务,不要用 web search
67
67
  2. **用中文回复** — 除非用户用其他语言
68
68
  3. **搜索要灵活** — 精确关键词没结果时,尝试更宽泛的词
69
+ 4. **消息元数据** — 收到的消息末尾可能附带 `[orderId: xxx]` 等元数据,用于关联订单
70
+ 5. **查询支付** — 用 `a2h_payment_status`(传 order_id)查询支付状态;用 `a2h_order_get`(传 order_id)查询订单详情
69
71
  4. **按需读取 Playbook** — 进入具体场景时再读对应的操作剧本
70
72
 
71
73
  ## 场景路由:读哪个 Playbook
@@ -138,6 +138,20 @@ export async function startAgentService(ctx: AgentServiceContext): Promise<void>
138
138
  // ② Dispatch to OpenClaw Agent via Channel Plugin SDK
139
139
  // Agent has full access to a2h_* tools
140
140
  // Session is per-peer: agent:main:a2hmarket:direct:{senderId}
141
+
142
+ // Build enriched body with structured context from payload
143
+ let enrichedBody = event.text;
144
+ const meta: string[] = [];
145
+ if (event.payload.orderId) meta.push(`[orderId: ${event.payload.orderId}]`);
146
+ if (event.payload.payment_qr) meta.push(`[payment_qr: ${event.payload.payment_qr}]`);
147
+ if (event.payload.attachment) {
148
+ const att = event.payload.attachment as Record<string, unknown>;
149
+ meta.push(`[attachment: ${att.name ?? att.url ?? "file"}]`);
150
+ }
151
+ if (meta.length > 0) {
152
+ enrichedBody = `${event.text}\n\n--- 消息元数据 ---\n${meta.join("\n")}`;
153
+ }
154
+
141
155
  try {
142
156
  await dispatchInboundDirectDmWithRuntime({
143
157
  cfg: ctx.cfg,
@@ -150,7 +164,7 @@ export async function startAgentService(ctx: AgentServiceContext): Promise<void>
150
164
  senderAddress: `a2hmarket:${event.senderId}`,
151
165
  recipientAddress: `a2hmarket:${creds.agentId}`,
152
166
  conversationLabel: event.senderId,
153
- rawBody: event.text,
167
+ rawBody: enrichedBody,
154
168
  messageId: event.messageId,
155
169
  timestamp: Date.now(),
156
170
  commandAuthorized: true,