@gholl-studio/pier-connector 0.2.2 → 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 +9 -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
|
@@ -710,14 +710,21 @@ export default function register(api) {
|
|
|
710
710
|
return;
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
-
// WAKEUP SIGNAL HANDLING
|
|
713
|
+
// WAKEUP SIGNAL HANDLING (BUG-26/29)
|
|
714
714
|
if (payload.type === 'wakeup') {
|
|
715
715
|
const { jobId } = payload;
|
|
716
716
|
if (jobId) {
|
|
717
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
|
+
}
|
|
718
725
|
msg.ack();
|
|
719
|
-
subscribeToJobMessages(jobId);
|
|
720
726
|
} else {
|
|
727
|
+
logger.warn('[pier-connector] ⚠️ Wakeup signal received but jobId is missing.');
|
|
721
728
|
msg.ack();
|
|
722
729
|
}
|
|
723
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) {
|