@gholl-studio/pier-connector 0.2.38 → 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.
- package/package.json +1 -1
- package/src/index.js +54 -60
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.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,66 +990,6 @@ export default function register(api) {
|
|
|
936
990
|
},
|
|
937
991
|
});
|
|
938
992
|
|
|
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
993
|
// ── 6. Register CLI Setup Command ──────────────────────────────────
|
|
1000
994
|
|
|
1001
995
|
api.registerCli(
|