@bountyagents/bountyagents-task 2026.3.117 → 2026.3.119
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/dist/index.js +54 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55894,6 +55894,22 @@ function registerWorkerTools(api3) {
|
|
|
55894
55894
|
|
|
55895
55895
|
// index.ts
|
|
55896
55896
|
import * as fs2 from "fs";
|
|
55897
|
+
import * as readline from "readline";
|
|
55898
|
+
var cli = {
|
|
55899
|
+
red: (s) => `\x1B[31m${s}\x1B[0m`,
|
|
55900
|
+
green: (s) => `\x1B[32m${s}\x1B[0m`,
|
|
55901
|
+
dim: (s) => `\x1B[2m${s}\x1B[0m`,
|
|
55902
|
+
dot: (color) => color === "red" ? cli.red("●") : cli.green("●")
|
|
55903
|
+
};
|
|
55904
|
+
function question(prompt) {
|
|
55905
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
55906
|
+
return new Promise((resolve) => {
|
|
55907
|
+
rl.question(prompt, (answer) => {
|
|
55908
|
+
rl.close();
|
|
55909
|
+
resolve(answer.trim());
|
|
55910
|
+
});
|
|
55911
|
+
});
|
|
55912
|
+
}
|
|
55897
55913
|
function register(api3) {
|
|
55898
55914
|
api3.registerCommand({
|
|
55899
55915
|
name: "mycustomcommand",
|
|
@@ -55906,32 +55922,56 @@ function register(api3) {
|
|
|
55906
55922
|
}
|
|
55907
55923
|
});
|
|
55908
55924
|
api3.registerCli(({ program }) => {
|
|
55909
|
-
program.command("upclaw").description("UpClaw Bounty Agents CLI").argument("[action]", "action: status, init, reset, etc.", "status").option("-v, --verbose", "verbose output").action((action, options) => {
|
|
55925
|
+
program.command("upclaw").description("UpClaw Bounty Agents CLI").argument("[action]", "action: status, init, reset, etc.", "status").option("-v, --verbose", "verbose output").action(async (action, options) => {
|
|
55910
55926
|
if (options.verbose)
|
|
55911
55927
|
console.log("Verbose mode");
|
|
55912
55928
|
if (action === "status") {
|
|
55913
55929
|
const address = getWalletAddress();
|
|
55914
55930
|
if (!address) {
|
|
55915
|
-
console.log("
|
|
55931
|
+
console.log(` ${cli.dot("red")} ${cli.red("Wallet not initialized")}`);
|
|
55932
|
+
console.log(cli.dim(" Run openclaw upclaw init to initialize"));
|
|
55916
55933
|
return;
|
|
55917
55934
|
}
|
|
55918
|
-
console.log("
|
|
55919
|
-
console.log("
|
|
55935
|
+
console.log(` ${cli.dot("green")} ${cli.green("Wallet initialized")}`);
|
|
55936
|
+
console.log(cli.dim(" Address: ") + address);
|
|
55920
55937
|
return;
|
|
55921
55938
|
}
|
|
55922
55939
|
if (action === "init") {
|
|
55923
55940
|
try {
|
|
55924
|
-
if (
|
|
55941
|
+
if (fs2.existsSync(KEY_PATH)) {
|
|
55942
|
+
console.log(` ${cli.dot("red")} ${cli.red("Key already exists")}`);
|
|
55943
|
+
console.log(cli.dim(` ${KEY_PATH}`));
|
|
55944
|
+
console.log(cli.dim(" Run openclaw upclaw reset first to use a different key."));
|
|
55945
|
+
return;
|
|
55946
|
+
}
|
|
55947
|
+
console.log("");
|
|
55948
|
+
console.log(cli.dim(" 1) Generate a new random private key"));
|
|
55949
|
+
console.log(cli.dim(" 2) Enter an existing private key to store"));
|
|
55950
|
+
console.log("");
|
|
55951
|
+
const choice = await question("Choose 1 or 2: ");
|
|
55952
|
+
if (choice === "1") {
|
|
55925
55953
|
const pk = generatePrivateKey();
|
|
55926
55954
|
fs2.writeFileSync(KEY_PATH, pk, "utf-8");
|
|
55927
|
-
|
|
55955
|
+
const address = privateKeyToAccount(pk).address;
|
|
55956
|
+
console.log(` ${cli.dot("green")} ${cli.green("New key generated and saved")}`);
|
|
55957
|
+
console.log(cli.dim(` Path: ${KEY_PATH}`));
|
|
55958
|
+
console.log(cli.dim(` Address: ${address}`));
|
|
55928
55959
|
return;
|
|
55929
|
-
}
|
|
55930
|
-
|
|
55960
|
+
}
|
|
55961
|
+
if (choice === "2") {
|
|
55962
|
+
const raw = await question("Enter private key (hex, with or without 0x): ");
|
|
55963
|
+
const key = raw.startsWith("0x") ? raw : `0x${raw}`;
|
|
55964
|
+
privateKeyToAccount(key);
|
|
55965
|
+
fs2.writeFileSync(KEY_PATH, key, "utf-8");
|
|
55966
|
+
const address = privateKeyToAccount(key).address;
|
|
55967
|
+
console.log(` ${cli.dot("green")} ${cli.green("Existing key stored")}`);
|
|
55968
|
+
console.log(cli.dim(` Path: ${KEY_PATH}`));
|
|
55969
|
+
console.log(cli.dim(` Address: ${address}`));
|
|
55931
55970
|
return;
|
|
55932
55971
|
}
|
|
55972
|
+
console.log(` ${cli.dot("red")} ${cli.red("Invalid choice. Enter 1 or 2.")}`);
|
|
55933
55973
|
} catch (error48) {
|
|
55934
|
-
console.
|
|
55974
|
+
console.log(` ${cli.dot("red")} ${cli.red("Failed to initialize key: " + error48.message)}`);
|
|
55935
55975
|
return;
|
|
55936
55976
|
}
|
|
55937
55977
|
}
|
|
@@ -55939,11 +55979,14 @@ function register(api3) {
|
|
|
55939
55979
|
try {
|
|
55940
55980
|
if (fs2.existsSync(KEY_PATH)) {
|
|
55941
55981
|
fs2.unlinkSync(KEY_PATH);
|
|
55942
|
-
console.log(`
|
|
55982
|
+
console.log(` ${cli.dot("green")} ${cli.green("Key removed")}`);
|
|
55983
|
+
console.log(cli.dim(` Deleted ${KEY_PATH}`));
|
|
55943
55984
|
return;
|
|
55944
55985
|
}
|
|
55986
|
+
console.log(` ${cli.dot("red")} ${cli.red("No key file found")}`);
|
|
55987
|
+
console.log(cli.dim(` ${KEY_PATH}`));
|
|
55945
55988
|
} catch (error48) {
|
|
55946
|
-
console.
|
|
55989
|
+
console.log(` ${cli.dot("red")} ${cli.red("Failed to reset key: " + error48.message)}`);
|
|
55947
55990
|
return;
|
|
55948
55991
|
}
|
|
55949
55992
|
}
|