@gholl-studio/pier-connector 0.3.24 → 0.3.25

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@gholl-studio/pier-connector",
3
3
  "author": "gholl",
4
- "version": "0.3.24",
4
+ "version": "0.3.25",
5
5
  "description": "OpenClaw plugin that connects to the Pier job marketplace. Automatically fetches, executes, and reports distributed tasks for rewards.",
6
6
  "type": "module",
7
7
  "main": "src/index.ts",
package/src/inbound.ts CHANGED
@@ -90,8 +90,8 @@ export async function handleInbound(
90
90
  WasMentioned: true,
91
91
  CommandAuthorized: true,
92
92
  SystemPrompt: injectedPrompt,
93
- MessageId: jobId,
94
- MessageSid: jobId,
93
+ MessageId: inbound.messageId,
94
+ MessageSid: inbound.messageId,
95
95
  Metadata: {
96
96
  ...metadata,
97
97
  accountId: robot.accountId,
package/src/robot.ts CHANGED
@@ -141,7 +141,9 @@ export class PierRobot {
141
141
  accountId: this.accountId,
142
142
  senderId: `pier:${msgPayload.sender_id}`,
143
143
  body: content,
144
- jobId: jobId
144
+ jobId: jobId,
145
+ // 必须使用每条消息的唯一 ID,否则 SDK 会把同一 job 的后续消息当重复消息丢弃
146
+ messageId: msgPayload.id || `${jobId}-${Date.now()}`
145
147
  };
146
148
  this.logger.info(`[pier-connector:trace] NATS Chat Message received on PierRobot instance accountId='${this.accountId}'. Passing to handleInbound...`);
147
149
  await this.onInbound(inbound, jobId);
@@ -238,7 +240,8 @@ export class PierRobot {
238
240
  accountId: this.accountId,
239
241
  senderId: `pier:${senderCore}`,
240
242
  body: finalText,
241
- jobId: job.id
243
+ jobId: job.id,
244
+ messageId: job.id // 初始任务消息用 job.id 作为唯一 ID
242
245
  }, job.id);
243
246
 
244
247
  this.isBusy = false;
package/src/types.ts CHANGED
@@ -32,6 +32,8 @@ export interface InboundMessage {
32
32
  senderId: string;
33
33
  body: string;
34
34
  jobId: string;
35
+ /** 每条 NATS 消息的唯一 ID(msgPayload.id),用于 SDK 去重,必须每条消息不同 */
36
+ messageId: string;
35
37
  }
36
38
 
37
39
  export type PierPluginApi = OpenClawPluginApi;