@gholl-studio/pier-connector 0.2.39 → 0.2.41
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/openclaw.plugin.json +3 -0
- package/package.json +1 -1
- package/src/index.js +61 -55
package/openclaw.plugin.json
CHANGED
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.41",
|
|
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
|
@@ -549,6 +549,8 @@ export default function register(api) {
|
|
|
549
549
|
aliases: ['pier-connector'],
|
|
550
550
|
},
|
|
551
551
|
|
|
552
|
+
id: 'pier',
|
|
553
|
+
|
|
552
554
|
capabilities: {
|
|
553
555
|
chatTypes: ['direct'],
|
|
554
556
|
},
|
|
@@ -587,60 +589,8 @@ export default function register(api) {
|
|
|
587
589
|
}
|
|
588
590
|
},
|
|
589
591
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
console.log('\n🚢 \x1b[1m\x1b[36mPier Channel Login\x1b[0m');
|
|
593
|
-
|
|
594
|
-
const answers = await inquirer.prompt([
|
|
595
|
-
{
|
|
596
|
-
type: 'input',
|
|
597
|
-
name: 'accountId',
|
|
598
|
-
message: 'Account Name (e.g., sunwukong, jolin):',
|
|
599
|
-
default: 'default',
|
|
600
|
-
validate: (input) => input.trim().length > 0 || 'Account name is required'
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
type: 'input',
|
|
604
|
-
name: 'pierApiUrl',
|
|
605
|
-
message: 'Pier API URL:',
|
|
606
|
-
default: DEFAULTS.PIER_API_URL
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
type: 'input',
|
|
610
|
-
name: 'nodeId',
|
|
611
|
-
message: 'Bot Node ID (UUID):',
|
|
612
|
-
validate: (input) => input.trim().length > 0 || 'Node ID is required'
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
type: 'password',
|
|
616
|
-
name: 'secretKey',
|
|
617
|
-
message: 'Bot Secret Key:',
|
|
618
|
-
validate: (input) => input.trim().length > 0 || 'Secret Key is required'
|
|
619
|
-
},
|
|
620
|
-
]);
|
|
621
|
-
|
|
622
|
-
console.log('\n\x1b[36mVerifying connection...\x1b[0m');
|
|
623
|
-
try {
|
|
624
|
-
const tempClient = new PierClient({ apiUrl: answers.pierApiUrl });
|
|
625
|
-
await tempClient.heartbeat(answers.nodeId, answers.secretKey);
|
|
626
|
-
|
|
627
|
-
console.log('\x1b[32m✔ Verified successfully!\x1b[0m');
|
|
628
|
-
|
|
629
|
-
return {
|
|
630
|
-
accountId: answers.accountId,
|
|
631
|
-
config: {
|
|
632
|
-
enabled: true,
|
|
633
|
-
pierApiUrl: answers.pierApiUrl,
|
|
634
|
-
nodeId: answers.nodeId,
|
|
635
|
-
secretKey: answers.secretKey
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
} catch (err) {
|
|
639
|
-
throw new Error(`Failed to verify Pier credentials: ${err.message}`);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
},
|
|
643
|
-
|
|
592
|
+
// Note: login is now moved to top-level of api.registerChannel
|
|
593
|
+
|
|
644
594
|
outbound: {
|
|
645
595
|
deliveryMode: 'direct',
|
|
646
596
|
|
|
@@ -732,7 +682,63 @@ export default function register(api) {
|
|
|
732
682
|
},
|
|
733
683
|
};
|
|
734
684
|
|
|
735
|
-
api.registerChannel({
|
|
685
|
+
api.registerChannel({
|
|
686
|
+
id: 'pier',
|
|
687
|
+
plugin: pierChannel,
|
|
688
|
+
login: {
|
|
689
|
+
handler: async () => {
|
|
690
|
+
console.log('\n🚢 \x1b[1m\x1b[36mPier Channel Login\x1b[0m');
|
|
691
|
+
|
|
692
|
+
const answers = await inquirer.prompt([
|
|
693
|
+
{
|
|
694
|
+
type: 'input',
|
|
695
|
+
name: 'accountId',
|
|
696
|
+
message: 'Account Name (e.g., sunwukong, jolin):',
|
|
697
|
+
default: 'default',
|
|
698
|
+
validate: (input) => input.trim().length > 0 || 'Account name is required'
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
type: 'input',
|
|
702
|
+
name: 'pierApiUrl',
|
|
703
|
+
message: 'Pier API URL:',
|
|
704
|
+
default: DEFAULTS.PIER_API_URL
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
type: 'input',
|
|
708
|
+
name: 'nodeId',
|
|
709
|
+
message: 'Bot Node ID (UUID):',
|
|
710
|
+
validate: (input) => input.trim().length > 0 || 'Node ID is required'
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
type: 'password',
|
|
714
|
+
name: 'secretKey',
|
|
715
|
+
message: 'Bot Secret Key:',
|
|
716
|
+
validate: (input) => input.trim().length > 0 || 'Secret Key is required'
|
|
717
|
+
},
|
|
718
|
+
]);
|
|
719
|
+
|
|
720
|
+
console.log('\n\x1b[36mVerifying connection...\x1b[0m');
|
|
721
|
+
try {
|
|
722
|
+
const tempClient = new PierClient({ apiUrl: answers.pierApiUrl });
|
|
723
|
+
await tempClient.heartbeat(answers.nodeId, answers.secretKey);
|
|
724
|
+
|
|
725
|
+
console.log('\x1b[32m✔ Verified successfully!\x1b[0m');
|
|
726
|
+
|
|
727
|
+
return {
|
|
728
|
+
accountId: answers.accountId,
|
|
729
|
+
config: {
|
|
730
|
+
enabled: true,
|
|
731
|
+
pierApiUrl: answers.pierApiUrl,
|
|
732
|
+
nodeId: answers.nodeId,
|
|
733
|
+
secretKey: answers.secretKey
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
} catch (err) {
|
|
737
|
+
throw new Error(`Failed to verify Pier credentials: ${err.message}`);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
});
|
|
736
742
|
|
|
737
743
|
// ── 2. Register background service ─────────────────────────────────
|
|
738
744
|
|