@gholl-studio/pier-connector 0.2.1 → 0.2.3
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/src/index.js +12 -2
- package/src/protocol.js +13 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gholl-studio/pier-connector",
|
|
3
3
|
"author": "gholl",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
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.js",
|
package/src/index.js
CHANGED
|
@@ -647,6 +647,9 @@ export default function register(api) {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
+
const content = msgPayload.content;
|
|
651
|
+
const senderCore = msgPayload.sender_id;
|
|
652
|
+
|
|
650
653
|
if (!content) {
|
|
651
654
|
logger.warn(`[pier-connector] ⚠️ Skipping message from ${senderCore} for ${jobId}: Empty content`);
|
|
652
655
|
msg.ack();
|
|
@@ -707,14 +710,21 @@ export default function register(api) {
|
|
|
707
710
|
return;
|
|
708
711
|
}
|
|
709
712
|
|
|
710
|
-
// WAKEUP SIGNAL HANDLING
|
|
713
|
+
// WAKEUP SIGNAL HANDLING (BUG-26/29)
|
|
711
714
|
if (payload.type === 'wakeup') {
|
|
712
715
|
const { jobId } = payload;
|
|
713
716
|
if (jobId) {
|
|
714
717
|
logger.info(`[pier-connector] ⏰ Received wakeup signal for job ${jobId}`);
|
|
718
|
+
if (jobSubscriptions.has(jobId)) {
|
|
719
|
+
logger.info(`[pier-connector] 👂 Already monitoring job ${jobId}, skipping duplicate subscription.`);
|
|
720
|
+
} else {
|
|
721
|
+
// Important: Map the job ID so we know where to reply
|
|
722
|
+
activeNodeJobs.set(jobId, { pierJobId: jobId });
|
|
723
|
+
await subscribeToJobMessages(jobId);
|
|
724
|
+
}
|
|
715
725
|
msg.ack();
|
|
716
|
-
subscribeToJobMessages(jobId);
|
|
717
726
|
} else {
|
|
727
|
+
logger.warn('[pier-connector] ⚠️ Wakeup signal received but jobId is missing.');
|
|
718
728
|
msg.ack();
|
|
719
729
|
}
|
|
720
730
|
return;
|
package/src/protocol.js
CHANGED
|
@@ -108,6 +108,19 @@ export function normalizeInboundPayload(payload) {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
// Support for Join-Chat wakeup signals (BUG-26/29)
|
|
112
|
+
if (payload.type === 'wakeup') {
|
|
113
|
+
const jobId = payload.jobId || payload.id;
|
|
114
|
+
if (!jobId) return { ok: false, error: 'Missing jobId in wakeup payload' };
|
|
115
|
+
return {
|
|
116
|
+
ok: true,
|
|
117
|
+
job: {
|
|
118
|
+
id: jobId,
|
|
119
|
+
type: 'wakeup'
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
111
124
|
// Fallback for legacy / generic JSON structures
|
|
112
125
|
const task = payload.task ?? payload.prompt ?? payload.content ?? '';
|
|
113
126
|
if (!task) {
|