@sherwoodagent/cli 0.3.0 → 0.3.2

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
@@ -35,6 +35,7 @@ import {
35
35
  getVaultInfo,
36
36
  getVeniceApiKey,
37
37
  getWalletClient,
38
+ isAgent,
38
39
  loadConfig,
39
40
  ragequit,
40
41
  registerAgent,
@@ -50,7 +51,7 @@ import {
50
51
  setVaultAddress,
51
52
  setVeniceApiKey,
52
53
  simulateBatch
53
- } from "./chunk-CR3ZNOB7.js";
54
+ } from "./chunk-I2G5OWKA.js";
54
55
 
55
56
  // src/index.ts
56
57
  import { config as loadDotenv } from "dotenv";
@@ -1868,7 +1869,7 @@ try {
1868
1869
  } catch {
1869
1870
  }
1870
1871
  async function loadXmtp() {
1871
- return import("./xmtp-4G7BTQZJ.js");
1872
+ return import("./xmtp-E3H4R6I6.js");
1872
1873
  }
1873
1874
  var G = chalk5.green;
1874
1875
  var W = chalk5.white;
@@ -2282,6 +2283,39 @@ syndicate.command("join").description("Request to join a syndicate (creates an E
2282
2283
  process.exit(1);
2283
2284
  }
2284
2285
  const syndicate2 = await resolveSyndicate(opts.subdomain);
2286
+ const callerAddress = getAccount().address;
2287
+ spinner.text = "Checking membership...";
2288
+ setVaultAddress(syndicate2.vault);
2289
+ const alreadyAgent = await isAgent(callerAddress);
2290
+ if (alreadyAgent) {
2291
+ spinner.succeed("You are already a registered agent on this syndicate");
2292
+ try {
2293
+ const xmtp = await loadXmtp();
2294
+ await xmtp.getXmtpClient();
2295
+ console.log(chalk5.dim(" XMTP identity ready"));
2296
+ } catch {
2297
+ console.warn(chalk5.yellow(" \u26A0 Could not initialize XMTP identity"));
2298
+ }
2299
+ return;
2300
+ }
2301
+ spinner.text = "Checking pending requests...";
2302
+ const pendingRequests = await queryJoinRequests(syndicate2.creator);
2303
+ const existingRequest = pendingRequests.find(
2304
+ (r) => r.attester.toLowerCase() === callerAddress.toLowerCase() && r.decoded.vault.toLowerCase() === syndicate2.vault.toLowerCase()
2305
+ );
2306
+ if (existingRequest) {
2307
+ spinner.succeed("You already have a pending join request for this syndicate");
2308
+ console.log(chalk5.dim(` Attestation: ${existingRequest.uid}`));
2309
+ console.log(chalk5.dim(` Submitted: ${new Date(existingRequest.time * 1e3).toLocaleString()}`));
2310
+ try {
2311
+ const xmtp = await loadXmtp();
2312
+ await xmtp.getXmtpClient();
2313
+ console.log(chalk5.dim(" XMTP identity ready"));
2314
+ } catch {
2315
+ console.warn(chalk5.yellow(" \u26A0 Could not initialize XMTP identity"));
2316
+ }
2317
+ return;
2318
+ }
2285
2319
  spinner.text = "Creating join request attestation...";
2286
2320
  const { uid, hash } = await createJoinRequest(
2287
2321
  syndicate2.id,
@@ -2672,7 +2706,7 @@ ${info.name} (${info.type})`);
2672
2706
  }
2673
2707
  });
2674
2708
  try {
2675
- const { registerChatCommands } = await import("./chat-X5PDOVZ6.js");
2709
+ const { registerChatCommands } = await import("./chat-PXNCEJ35.js");
2676
2710
  registerChatCommands(program);
2677
2711
  } catch {
2678
2712
  program.command("chat <name> [action] [actionArgs...]").description("Syndicate chat (XMTP) \u2014 requires @xmtp/cli").action(() => {