@gholl-studio/pier-connector 0.2.37 → 0.2.39

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 +55 -1
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.37",
4
+ "version": "0.2.39",
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
@@ -587,6 +587,60 @@ export default function register(api) {
587
587
  }
588
588
  },
589
589
 
590
+ login: {
591
+ handler: async () => {
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
+
590
644
  outbound: {
591
645
  deliveryMode: 'direct',
592
646
 
@@ -936,7 +990,7 @@ export default function register(api) {
936
990
  },
937
991
  });
938
992
 
939
- // ── 5. Register CLI Setup Command ──────────────────────────────────
993
+ // ── 6. Register CLI Setup Command ──────────────────────────────────
940
994
 
941
995
  api.registerCli(
942
996
  ({ program }) => {