@gholl-studio/pier-connector 0.2.40 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +56 -55
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.40",
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
@@ -589,60 +589,8 @@ export default function register(api) {
589
589
  }
590
590
  },
591
591
 
592
- login: {
593
- handler: async () => {
594
- console.log('\n🚢 \x1b[1m\x1b[36mPier Channel Login\x1b[0m');
595
-
596
- const answers = await inquirer.prompt([
597
- {
598
- type: 'input',
599
- name: 'accountId',
600
- message: 'Account Name (e.g., sunwukong, jolin):',
601
- default: 'default',
602
- validate: (input) => input.trim().length > 0 || 'Account name is required'
603
- },
604
- {
605
- type: 'input',
606
- name: 'pierApiUrl',
607
- message: 'Pier API URL:',
608
- default: DEFAULTS.PIER_API_URL
609
- },
610
- {
611
- type: 'input',
612
- name: 'nodeId',
613
- message: 'Bot Node ID (UUID):',
614
- validate: (input) => input.trim().length > 0 || 'Node ID is required'
615
- },
616
- {
617
- type: 'password',
618
- name: 'secretKey',
619
- message: 'Bot Secret Key:',
620
- validate: (input) => input.trim().length > 0 || 'Secret Key is required'
621
- },
622
- ]);
623
-
624
- console.log('\n\x1b[36mVerifying connection...\x1b[0m');
625
- try {
626
- const tempClient = new PierClient({ apiUrl: answers.pierApiUrl });
627
- await tempClient.heartbeat(answers.nodeId, answers.secretKey);
628
-
629
- console.log('\x1b[32m✔ Verified successfully!\x1b[0m');
630
-
631
- return {
632
- accountId: answers.accountId,
633
- config: {
634
- enabled: true,
635
- pierApiUrl: answers.pierApiUrl,
636
- nodeId: answers.nodeId,
637
- secretKey: answers.secretKey
638
- }
639
- };
640
- } catch (err) {
641
- throw new Error(`Failed to verify Pier credentials: ${err.message}`);
642
- }
643
- }
644
- },
645
-
592
+ // Note: login is now moved to top-level of api.registerChannel
593
+
646
594
  outbound: {
647
595
  deliveryMode: 'direct',
648
596
 
@@ -736,7 +684,60 @@ export default function register(api) {
736
684
 
737
685
  api.registerChannel({
738
686
  id: 'pier',
739
- plugin: pierChannel
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
+ }
740
741
  });
741
742
 
742
743
  // ── 2. Register background service ─────────────────────────────────