@gholl-studio/pier-connector 0.2.37 → 0.2.38

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 +61 -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.38",
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
@@ -936,7 +936,67 @@ export default function register(api) {
936
936
  },
937
937
  });
938
938
 
939
- // ── 5. Register CLI Setup Command ──────────────────────────────────
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
+ // ── 6. Register CLI Setup Command ──────────────────────────────────
940
1000
 
941
1001
  api.registerCli(
942
1002
  ({ program }) => {