@gholl-studio/pier-connector 0.2.38 → 0.2.40

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.
@@ -6,6 +6,9 @@
6
6
  "channels": [
7
7
  "pier"
8
8
  ],
9
+ "features": [
10
+ "login"
11
+ ],
9
12
  "configSchema": {
10
13
  "type": "object",
11
14
  "additionalProperties": false,
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.38",
4
+ "version": "0.2.40",
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,6 +589,60 @@ export default function register(api) {
587
589
  }
588
590
  },
589
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
+
590
646
  outbound: {
591
647
  deliveryMode: 'direct',
592
648
 
@@ -678,7 +734,10 @@ export default function register(api) {
678
734
  },
679
735
  };
680
736
 
681
- api.registerChannel({ plugin: pierChannel });
737
+ api.registerChannel({
738
+ id: 'pier',
739
+ plugin: pierChannel
740
+ });
682
741
 
683
742
  // ── 2. Register background service ─────────────────────────────────
684
743
 
@@ -936,66 +995,6 @@ export default function register(api) {
936
995
  },
937
996
  });
938
997
 
939
- // ── 5. Register Interactive Channel Login ─────────────────────────
940
-
941
- if (typeof api.bindLogin === 'function') {
942
- api.bindLogin({
943
- channel: 'pier',
944
- handler: async () => {
945
- console.log('\n🚢 \x1b[1m\x1b[36mPier Channel Login\x1b[0m');
946
-
947
- const answers = await inquirer.prompt([
948
- {
949
- type: 'input',
950
- name: 'accountId',
951
- message: 'Account Name (e.g., sunwukong, jolin):',
952
- default: 'default',
953
- validate: (input) => input.trim().length > 0 || 'Account name is required'
954
- },
955
- {
956
- type: 'input',
957
- name: 'pierApiUrl',
958
- message: 'Pier API URL:',
959
- default: DEFAULTS.PIER_API_URL
960
- },
961
- {
962
- type: 'input',
963
- name: 'nodeId',
964
- message: 'Bot Node ID (UUID):',
965
- validate: (input) => input.trim().length > 0 || 'Node ID is required'
966
- },
967
- {
968
- type: 'password',
969
- name: 'secretKey',
970
- message: 'Bot Secret Key:',
971
- validate: (input) => input.trim().length > 0 || 'Secret Key is required'
972
- },
973
- ]);
974
-
975
- console.log('\n\x1b[36mVerifying connection...\x1b[0m');
976
- try {
977
- const tempClient = new PierClient({ apiUrl: answers.pierApiUrl });
978
- // Verify credentials via a simple heartbeat
979
- await tempClient.heartbeat(answers.nodeId, answers.secretKey);
980
-
981
- console.log('\x1b[32m✔ Verified successfully!\x1b[0m');
982
-
983
- return {
984
- accountId: answers.accountId,
985
- config: {
986
- enabled: true,
987
- pierApiUrl: answers.pierApiUrl,
988
- nodeId: answers.nodeId,
989
- secretKey: answers.secretKey
990
- }
991
- };
992
- } catch (err) {
993
- throw new Error(`Failed to verify Pier credentials: ${err.message}`);
994
- }
995
- }
996
- });
997
- }
998
-
999
998
  // ── 6. Register CLI Setup Command ──────────────────────────────────
1000
999
 
1001
1000
  api.registerCli(