agenticmail 0.3.5 → 0.3.6

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 +64 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -580,7 +580,7 @@ async function interactiveShell(options) {
580
580
  }
581
581
  },
582
582
  agents: {
583
- desc: "List all agents",
583
+ desc: "List agents or create a new one",
584
584
  run: async () => {
585
585
  log("");
586
586
  try {
@@ -593,7 +593,7 @@ async function interactiveShell(options) {
593
593
  const data = await resp.json();
594
594
  const agents = data.agents || data || [];
595
595
  if (agents.length === 0) {
596
- info("No agents yet. Run /setup to create one.");
596
+ info("No agents yet.");
597
597
  } else {
598
598
  for (const agent of agents) {
599
599
  const owner = agent.metadata?.ownerName;
@@ -607,6 +607,68 @@ async function interactiveShell(options) {
607
607
  info("Use /switch to change active agent");
608
608
  }
609
609
  }
610
+ log("");
611
+ log(` ${c.green("[1]")} Create new agent`);
612
+ log(` ${c.green("[2]")} Back`);
613
+ log("");
614
+ const choice = await question(` ${c.dim(">")}: `);
615
+ if (isBack(choice) || choice.trim() === "2") {
616
+ log("");
617
+ return;
618
+ }
619
+ if (choice.trim() !== "1") {
620
+ log("");
621
+ return;
622
+ }
623
+ log("");
624
+ const nameInput = await question(` ${c.cyan("Agent name:")} `);
625
+ if (isBack(nameInput) || !nameInput.trim()) {
626
+ log("");
627
+ return;
628
+ }
629
+ const agentName = nameInput.trim();
630
+ log("");
631
+ log(` ${c.bold("Role")}`);
632
+ log(` ${c.green("[1]")} secretary ${c.dim("(default)")}`);
633
+ log(` ${c.green("[2]")} assistant`);
634
+ log(` ${c.green("[3]")} researcher`);
635
+ log(` ${c.green("[4]")} writer`);
636
+ log(` ${c.green("[5]")} custom`);
637
+ log("");
638
+ const roleChoice = await question(` ${c.dim(">")}: `);
639
+ if (isBack(roleChoice)) {
640
+ log("");
641
+ return;
642
+ }
643
+ const roles = ["secretary", "assistant", "researcher", "writer", "custom"];
644
+ const roleIdx = parseInt(roleChoice.trim()) - 1;
645
+ const role = roleIdx >= 0 && roleIdx < roles.length ? roles[roleIdx] : "secretary";
646
+ log("");
647
+ info("Creating agent...");
648
+ const createResp = await apiFetch("/api/agenticmail/accounts", {
649
+ method: "POST",
650
+ body: JSON.stringify({ name: agentName, role }),
651
+ signal: AbortSignal.timeout(15e3)
652
+ });
653
+ if (!createResp.ok) {
654
+ const text = await createResp.text();
655
+ let parsed = {};
656
+ try {
657
+ parsed = JSON.parse(text);
658
+ } catch {
659
+ }
660
+ fail(parsed.error || text);
661
+ log("");
662
+ return;
663
+ }
664
+ const created = await createResp.json();
665
+ ok(`Agent ${c.bold('"' + created.name + '"')} created!`);
666
+ log(` ${c.dim("Email:")} ${c.cyan(created.email || created.subAddress || "")}`);
667
+ log(` ${c.dim("Key:")} ${c.yellow(created.apiKey)}`);
668
+ log(` ${c.dim("Role:")} ${role}`);
669
+ currentAgent = { name: created.name, email: created.email || created.subAddress, apiKey: created.apiKey };
670
+ ok(`Switched to ${c.bold(created.name)}`);
671
+ log("");
610
672
  } catch (err) {
611
673
  fail(`Error: ${errMsg(err)}`);
612
674
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenticmail",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Email infrastructure for AI agents — send and receive real email programmatically",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",