@gholl-studio/pier-connector 0.2.0 → 0.2.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.
- package/package.json +1 -1
- package/src/index.js +26 -11
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.1",
|
|
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
|
@@ -597,7 +597,7 @@ export default function register(api) {
|
|
|
597
597
|
const cInfo = await jsm.consumers.add(streamName, {
|
|
598
598
|
durable_name: durableName,
|
|
599
599
|
filter_subject: msgSubject,
|
|
600
|
-
deliver_policy: DeliverPolicy.New, //
|
|
600
|
+
deliver_policy: DeliverPolicy.New, // Reverted to New to stop message storms (BUG-27)
|
|
601
601
|
ack_policy: AckPolicy.Explicit,
|
|
602
602
|
ack_wait: 30000,
|
|
603
603
|
});
|
|
@@ -607,8 +607,9 @@ export default function register(api) {
|
|
|
607
607
|
jobSubscriptions.set(jobId, iter);
|
|
608
608
|
|
|
609
609
|
(async () => {
|
|
610
|
-
logger.info(`[pier-connector] 👂 Monitoring
|
|
610
|
+
logger.info(`[pier-connector] 👂 Monitoring chat subject ${msgSubject} (Durable: ${durableName})`);
|
|
611
611
|
|
|
612
|
+
let isProcessing = false;
|
|
612
613
|
for await (const msg of iter) {
|
|
613
614
|
try {
|
|
614
615
|
const rawMsg = new TextDecoder().decode(msg.data);
|
|
@@ -646,10 +647,19 @@ export default function register(api) {
|
|
|
646
647
|
}
|
|
647
648
|
}
|
|
648
649
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
650
|
+
if (!content) {
|
|
651
|
+
logger.warn(`[pier-connector] ⚠️ Skipping message from ${senderCore} for ${jobId}: Empty content`);
|
|
652
|
+
msg.ack();
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (isProcessing) {
|
|
657
|
+
logger.warn(`[pier-connector] ⏳ Throttling: Agent already processing for job ${jobId}`);
|
|
658
|
+
msg.nak();
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
logger.info(`[pier-connector] 📥 Incoming chat: [${jobId}] sender=${senderCore} "${truncate(content, 40)}"`);
|
|
653
663
|
|
|
654
664
|
activeNodeJobs.set(jobId, {
|
|
655
665
|
pierJobId: jobId,
|
|
@@ -657,11 +667,16 @@ export default function register(api) {
|
|
|
657
667
|
});
|
|
658
668
|
|
|
659
669
|
// Trigger agent
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
670
|
+
try {
|
|
671
|
+
isProcessing = true;
|
|
672
|
+
await receiveIncoming({
|
|
673
|
+
accountId: config.accountId || 'default',
|
|
674
|
+
senderId: `pier:${senderCore}`,
|
|
675
|
+
text: content,
|
|
676
|
+
}, jobId);
|
|
677
|
+
} finally {
|
|
678
|
+
isProcessing = false;
|
|
679
|
+
}
|
|
665
680
|
|
|
666
681
|
msg.ack();
|
|
667
682
|
} catch (err) {
|