agenticmail 0.5.26 → 0.5.28

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.
Files changed (2) hide show
  1. package/dist/cli.js +70 -44
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -4776,9 +4776,12 @@ async function cmdSetup() {
4776
4776
  }
4777
4777
  log2("");
4778
4778
  let emailOk = false;
4779
+ let lastRelayInfo;
4779
4780
  while (!emailOk) {
4780
4781
  if (choice === "1") {
4781
- emailOk = await setupRelay(result.config);
4782
+ const relayResult = await setupRelay(result.config, lastRelayInfo);
4783
+ emailOk = relayResult.success;
4784
+ lastRelayInfo = relayResult.info;
4782
4785
  } else {
4783
4786
  await setupDomain(result.config);
4784
4787
  emailOk = true;
@@ -5072,44 +5075,67 @@ async function registerWithOpenClaw(config) {
5072
5075
  } catch {
5073
5076
  }
5074
5077
  }
5075
- async function setupRelay(config) {
5076
- log2(" Which email service do you use?");
5077
- log2(` ${c2.cyan("1.")} Gmail`);
5078
- log2(` ${c2.cyan("2.")} Outlook / Hotmail`);
5079
- log2(` ${c2.cyan("3.")} Something else`);
5080
- const provChoice = await pick(` ${c2.magenta(">")} `, ["1", "2", "3"]);
5078
+ async function setupRelay(config, previous) {
5081
5079
  let provider;
5082
- if (provChoice === "1") provider = "gmail";
5083
- else if (provChoice === "2") provider = "outlook";
5084
- else provider = "custom";
5085
- const email = await ask(` ${c2.cyan("Your email address:")} `);
5086
- if (provider === "gmail") {
5087
- log2("");
5088
- log2(` ${c2.dim("You'll need a Gmail App Password.")}`);
5089
- log2(` ${c2.dim("1. Go to")} ${c2.cyan("https://myaccount.google.com/apppasswords")}`);
5090
- log2(` ${c2.dim("2. Create an app password and copy it")}`);
5091
- log2(` ${c2.dim("3. Paste it below (spaces are fine, we'll remove them)")}`);
5092
- } else if (provider === "outlook") {
5093
- log2(` ${c2.dim("You'll need an Outlook App Password from your account security settings.")}`);
5094
- }
5095
- log2("");
5080
+ let email;
5081
+ let name;
5096
5082
  let smtpHost;
5097
5083
  let smtpPort;
5098
5084
  let imapHost;
5099
5085
  let imapPort;
5100
- if (provider === "custom") {
5101
- log2(` ${c2.dim("We need your email server details (check your provider's settings):")}`);
5102
- smtpHost = await ask(` ${c2.cyan("Outgoing mail server:")} `);
5103
- const smtpPortStr = await ask(` ${c2.cyan("Outgoing port")} ${c2.dim("(usually 587)")}: `);
5104
- smtpPort = smtpPortStr ? parseInt(smtpPortStr, 10) : 587;
5105
- imapHost = await ask(` ${c2.cyan("Incoming mail server:")} `);
5106
- const imapPortStr = await ask(` ${c2.cyan("Incoming port")} ${c2.dim("(usually 993)")}: `);
5107
- imapPort = imapPortStr ? parseInt(imapPortStr, 10) : 993;
5086
+ if (previous) {
5087
+ log2(` ${c2.dim("Using your previous settings:")}`);
5088
+ log2(` ${c2.dim("Email:")} ${c2.cyan(previous.email)}`);
5089
+ log2(` ${c2.dim("Agent name:")} ${c2.cyan(previous.name)}`);
5090
+ log2("");
5091
+ const change = await ask(` ${c2.bold("Change these?")} ${c2.dim("(y/N)")} `);
5092
+ if (change.toLowerCase().startsWith("y")) {
5093
+ previous = void 0;
5094
+ } else {
5095
+ provider = previous.provider;
5096
+ email = previous.email;
5097
+ name = previous.name;
5098
+ smtpHost = previous.smtpHost;
5099
+ smtpPort = previous.smtpPort;
5100
+ imapHost = previous.imapHost;
5101
+ imapPort = previous.imapPort;
5102
+ }
5103
+ }
5104
+ if (!previous) {
5105
+ log2(" Which email service do you use?");
5106
+ log2(` ${c2.cyan("1.")} Gmail`);
5107
+ log2(` ${c2.cyan("2.")} Outlook / Hotmail`);
5108
+ log2(` ${c2.cyan("3.")} Something else`);
5109
+ const provChoice = await pick(` ${c2.magenta(">")} `, ["1", "2", "3"]);
5110
+ if (provChoice === "1") provider = "gmail";
5111
+ else if (provChoice === "2") provider = "outlook";
5112
+ else provider = "custom";
5113
+ email = await ask(` ${c2.cyan("Your email address:")} `);
5114
+ if (provider === "gmail") {
5115
+ log2("");
5116
+ log2(` ${c2.dim("You'll need a Gmail App Password.")}`);
5117
+ log2(` ${c2.dim("1. Go to")} ${c2.cyan("https://myaccount.google.com/apppasswords")}`);
5118
+ log2(` ${c2.dim("2. Create an app password and copy it")}`);
5119
+ log2(` ${c2.dim("3. Paste it below (spaces are fine, we'll remove them)")}`);
5120
+ } else if (provider === "outlook") {
5121
+ log2(` ${c2.dim("You'll need an Outlook App Password from your account security settings.")}`);
5122
+ }
5108
5123
  log2("");
5124
+ if (provider === "custom") {
5125
+ log2(` ${c2.dim("We need your email server details (check your provider's settings):")}`);
5126
+ smtpHost = await ask(` ${c2.cyan("Outgoing mail server:")} `);
5127
+ const smtpPortStr = await ask(` ${c2.cyan("Outgoing port")} ${c2.dim("(usually 587)")}: `);
5128
+ smtpPort = smtpPortStr ? parseInt(smtpPortStr, 10) : 587;
5129
+ imapHost = await ask(` ${c2.cyan("Incoming mail server:")} `);
5130
+ const imapPortStr = await ask(` ${c2.cyan("Incoming port")} ${c2.dim("(usually 993)")}: `);
5131
+ imapPort = imapPortStr ? parseInt(imapPortStr, 10) : 993;
5132
+ log2("");
5133
+ }
5134
+ log2(` ${c2.dim("Give your AI agent a name \u2014 this is what people will see in emails.")}`);
5135
+ const agentName = await ask(` ${c2.cyan("Agent name")} ${c2.dim("(secretary)")}: `);
5136
+ name = agentName.trim() || "secretary";
5109
5137
  }
5110
- log2(` ${c2.dim("Give your AI agent a name \u2014 this is what people will see in emails.")}`);
5111
- const agentName = await ask(` ${c2.cyan("Agent name")} ${c2.dim("(secretary)")}: `);
5112
- const name = agentName.trim() || "secretary";
5138
+ const relayInfo = { provider, email, name, smtpHost, smtpPort, imapHost, imapPort };
5113
5139
  const apiBase = `http://${config.api.host}:${config.api.port}`;
5114
5140
  const MAX_ATTEMPTS = 3;
5115
5141
  for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
@@ -5126,14 +5152,14 @@ async function setupRelay(config) {
5126
5152
  "Content-Type": "application/json"
5127
5153
  },
5128
5154
  body: JSON.stringify({
5129
- provider,
5130
- email,
5155
+ provider: relayInfo.provider,
5156
+ email: relayInfo.email,
5131
5157
  password,
5132
- smtpHost,
5133
- smtpPort,
5134
- imapHost,
5135
- imapPort,
5136
- agentName: name
5158
+ smtpHost: relayInfo.smtpHost,
5159
+ smtpPort: relayInfo.smtpPort,
5160
+ imapHost: relayInfo.imapHost,
5161
+ imapPort: relayInfo.imapPort,
5162
+ agentName: relayInfo.name
5137
5163
  }),
5138
5164
  signal: AbortSignal.timeout(3e4)
5139
5165
  });
@@ -5151,7 +5177,7 @@ async function setupRelay(config) {
5151
5177
  log2("");
5152
5178
  info2("Double-check your email and app password, then run: agenticmail setup");
5153
5179
  }
5154
- return false;
5180
+ return { success: false, info: relayInfo };
5155
5181
  }
5156
5182
  const data = await response.json();
5157
5183
  spinner.succeed("Email connected!");
@@ -5162,15 +5188,15 @@ async function setupRelay(config) {
5162
5188
  log2(` ${c2.dim("Agent key:")} ${c2.yellow(data.agent.apiKey)}`);
5163
5189
  log2("");
5164
5190
  info2("People can email your agent at the address above.");
5165
- await sendWelcomeEmail(apiBase, data.agent.apiKey, email, data.agent.name, data.agent.subAddress);
5191
+ await sendWelcomeEmail(apiBase, data.agent.apiKey, relayInfo.email, data.agent.name, data.agent.subAddress);
5166
5192
  }
5167
- return true;
5193
+ return { success: true, info: relayInfo };
5168
5194
  } catch (err) {
5169
5195
  spinner.fail(`Couldn't connect: ${err.message}`);
5170
- return false;
5196
+ return { success: false, info: relayInfo };
5171
5197
  }
5172
5198
  }
5173
- return false;
5199
+ return { success: false, info: relayInfo };
5174
5200
  }
5175
5201
  function parseFriendlyError(rawText) {
5176
5202
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenticmail",
3
- "version": "0.5.26",
3
+ "version": "0.5.28",
4
4
  "description": "Email and SMS infrastructure for AI agents \u2014 the first platform to give agents real email addresses and phone numbers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",