@sherwoodagent/cli 0.78.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 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
- if (!opts.bindingSig) {
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(" (e.g. via the acp CLI / app.virtuals.io wallet signing, EIP-191 personal_sign)"));
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: opts.bindingSig
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: opts.bindingSig, message: bindingMessage };
4297
+ binding = { sig: bindingSig, message: bindingMessage };
4274
4298
  }
4275
4299
  setVirtualsIdentity(Number(tokenId), issuingChainId, {
4276
4300
  agentId: virtualsAgentId,
@@ -9631,7 +9655,7 @@ try {
9631
9655
  } catch {
9632
9656
  }
9633
9657
  var require2 = createRequire(import.meta.url);
9634
- var CLI_VERSION = "0.78.0";
9658
+ var CLI_VERSION = "0.79.0";
9635
9659
  async function loadXmtp() {
9636
9660
  return import("./xmtp-OZ5PJFCT.js");
9637
9661
  }