@sherwoodagent/cli 0.77.0 → 0.79.0
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 +46 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4033,6 +4033,22 @@ async function detectAcp() {
|
|
|
4033
4033
|
return false;
|
|
4034
4034
|
}
|
|
4035
4035
|
}
|
|
4036
|
+
async function acpSignMessage(message) {
|
|
4037
|
+
try {
|
|
4038
|
+
const { stdout } = await execFileAsync(
|
|
4039
|
+
"acp",
|
|
4040
|
+
["wallet", "sign-message", "--message", message, "--json"],
|
|
4041
|
+
{ timeout: 6e4 }
|
|
4042
|
+
);
|
|
4043
|
+
const start = stdout.indexOf("{");
|
|
4044
|
+
if (start < 0) return null;
|
|
4045
|
+
const json = JSON.parse(stdout.slice(start));
|
|
4046
|
+
const sig = json.signature;
|
|
4047
|
+
return typeof sig === "string" && /^0x[0-9a-fA-F]{130}$/.test(sig) ? sig : null;
|
|
4048
|
+
} catch {
|
|
4049
|
+
return null;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4036
4052
|
async function acpWhoami() {
|
|
4037
4053
|
const json = await acpJson(["agent", "whoami"]);
|
|
4038
4054
|
if (!json) return null;
|
|
@@ -4246,13 +4262,21 @@ function registerIdentityCommands(program2) {
|
|
|
4246
4262
|
const bindingMessage = buildBindingMessage(account.address, issuingChainId, tokenId);
|
|
4247
4263
|
let binding;
|
|
4248
4264
|
if (!self) {
|
|
4249
|
-
|
|
4265
|
+
let bindingSig = opts.bindingSig;
|
|
4266
|
+
if (!bindingSig) {
|
|
4267
|
+
spinner.text = "Requesting binding signature from the economyOS wallet (acp wallet sign-message)...";
|
|
4268
|
+
bindingSig = await acpSignMessage(bindingMessage) ?? void 0;
|
|
4269
|
+
if (bindingSig) {
|
|
4270
|
+
console.log(chalk4.dim(" Binding signed automatically via acp."));
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
if (!bindingSig) {
|
|
4250
4274
|
spinner.fail("Binding signature required (economyOS wallet differs from your Sherwood wallet)");
|
|
4251
4275
|
console.error();
|
|
4252
4276
|
console.error(chalk4.bold(" Sign this exact message with the economyOS agent wallet:"));
|
|
4253
4277
|
console.error(chalk4.green(` ${bindingMessage}`));
|
|
4254
4278
|
console.error();
|
|
4255
|
-
console.error(chalk4.dim(
|
|
4279
|
+
console.error(chalk4.dim(` acp wallet sign-message --message "${bindingMessage}" --json`));
|
|
4256
4280
|
console.error(chalk4.dim(" Then re-run with --binding-sig <signature>."));
|
|
4257
4281
|
process.exit(1);
|
|
4258
4282
|
}
|
|
@@ -4262,7 +4286,7 @@ function registerIdentityCommands(program2) {
|
|
|
4262
4286
|
issuingChainId,
|
|
4263
4287
|
tokenId,
|
|
4264
4288
|
virtualsWallet,
|
|
4265
|
-
signature:
|
|
4289
|
+
signature: bindingSig
|
|
4266
4290
|
});
|
|
4267
4291
|
if (!ok) {
|
|
4268
4292
|
spinner.fail("Binding signature does not recover to the economyOS wallet");
|
|
@@ -4270,7 +4294,7 @@ function registerIdentityCommands(program2) {
|
|
|
4270
4294
|
console.error(chalk4.dim(` Signed message must be exactly: ${bindingMessage}`));
|
|
4271
4295
|
process.exit(1);
|
|
4272
4296
|
}
|
|
4273
|
-
binding = { sig:
|
|
4297
|
+
binding = { sig: bindingSig, message: bindingMessage };
|
|
4274
4298
|
}
|
|
4275
4299
|
setVirtualsIdentity(Number(tokenId), issuingChainId, {
|
|
4276
4300
|
agentId: virtualsAgentId,
|
|
@@ -6880,11 +6904,25 @@ function registerGuardianCommands(program2) {
|
|
|
6880
6904
|
process.exit(1);
|
|
6881
6905
|
}
|
|
6882
6906
|
});
|
|
6883
|
-
guardian.command("stake <amount>").description("Stake as a guardian. Amount in WOOD (min = registry.minGuardianStake).").option("--agent-id <id>", "ERC-8004 agent ID to associate (first-stake only
|
|
6907
|
+
guardian.command("stake <amount>").description("Stake as a guardian. Amount in WOOD (min = registry.minGuardianStake).").option("--agent-id <id>", "ERC-8004 agent ID to associate (first-stake only; default: your linked identity, else 0)").action(async (amountStr, opts) => {
|
|
6884
6908
|
const amount = parseUnits6(amountStr, 18);
|
|
6885
|
-
|
|
6909
|
+
let agentIdStr = opts.agentId;
|
|
6910
|
+
if (agentIdStr == null) {
|
|
6911
|
+
const linked = getAgentId();
|
|
6912
|
+
if (linked != null) {
|
|
6913
|
+
agentIdStr = String(linked);
|
|
6914
|
+
const provider = getIdentityProvider();
|
|
6915
|
+
const chainNote = provider === "virtuals" ? getIdentityChainId() === 0 ? " (Virtuals, wallet-only)" : ` (Virtuals, chain ${getIdentityChainId()})` : "";
|
|
6916
|
+
console.log(chalk9.dim(` Associating linked identity #${linked}${chainNote} \u2014 override with --agent-id`));
|
|
6917
|
+
} else {
|
|
6918
|
+
agentIdStr = "0";
|
|
6919
|
+
console.log(chalk9.dim(" No linked identity \u2014 staking with agentId 0."));
|
|
6920
|
+
console.log(chalk9.dim(" Tip: sherwood identity mint / identity link-virtuals first to attribute your guardian work."));
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
const agentId = BigInt(agentIdStr);
|
|
6886
6924
|
if (isCalldataOnly()) {
|
|
6887
|
-
emitCalldata(encodeGuardianStake({ amount, agentId:
|
|
6925
|
+
emitCalldata(encodeGuardianStake({ amount, agentId: agentIdStr }, getChain().id));
|
|
6888
6926
|
return;
|
|
6889
6927
|
}
|
|
6890
6928
|
await ensureWoodAllowance(amount);
|
|
@@ -9617,7 +9655,7 @@ try {
|
|
|
9617
9655
|
} catch {
|
|
9618
9656
|
}
|
|
9619
9657
|
var require2 = createRequire(import.meta.url);
|
|
9620
|
-
var CLI_VERSION = "0.
|
|
9658
|
+
var CLI_VERSION = "0.79.0";
|
|
9621
9659
|
async function loadXmtp() {
|
|
9622
9660
|
return import("./xmtp-OZ5PJFCT.js");
|
|
9623
9661
|
}
|