@agenticmail/enterprise 0.5.62 → 0.5.63

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.
@@ -0,0 +1,48 @@
1
+ // src/db/factory.ts
2
+ var ADAPTER_MAP = {
3
+ postgres: () => import("./postgres-QGWJ3CTZ.js").then((m) => m.PostgresAdapter),
4
+ supabase: () => import("./postgres-QGWJ3CTZ.js").then((m) => m.PostgresAdapter),
5
+ // Supabase IS Postgres
6
+ neon: () => import("./postgres-QGWJ3CTZ.js").then((m) => m.PostgresAdapter),
7
+ // Neon IS Postgres
8
+ cockroachdb: () => import("./postgres-QGWJ3CTZ.js").then((m) => m.PostgresAdapter),
9
+ // CockroachDB is PG-compatible
10
+ mysql: () => import("./mysql-SPPOCBFA.js").then((m) => m.MysqlAdapter),
11
+ planetscale: () => import("./mysql-SPPOCBFA.js").then((m) => m.MysqlAdapter),
12
+ // PlanetScale IS MySQL
13
+ mongodb: () => import("./mongodb-MWH3DGZY.js").then((m) => m.MongoAdapter),
14
+ sqlite: () => import("./sqlite-BA2TMKVB.js").then((m) => m.SqliteAdapter),
15
+ turso: () => import("./turso-CEAPRUFX.js").then((m) => m.TursoAdapter),
16
+ dynamodb: () => import("./dynamodb-QS64UREL.js").then((m) => m.DynamoAdapter)
17
+ };
18
+ async function createAdapter(config) {
19
+ const loader = ADAPTER_MAP[config.type];
20
+ if (!loader) {
21
+ throw new Error(
22
+ `Unsupported database type: "${config.type}". Supported: ${Object.keys(ADAPTER_MAP).join(", ")}`
23
+ );
24
+ }
25
+ const AdapterClass = await loader();
26
+ const adapter = new AdapterClass();
27
+ await adapter.connect(config);
28
+ return adapter;
29
+ }
30
+ function getSupportedDatabases() {
31
+ return [
32
+ { type: "postgres", label: "PostgreSQL", group: "SQL" },
33
+ { type: "mysql", label: "MySQL / MariaDB", group: "SQL" },
34
+ { type: "sqlite", label: "SQLite (embedded, dev/small)", group: "SQL" },
35
+ { type: "mongodb", label: "MongoDB", group: "NoSQL" },
36
+ { type: "turso", label: "Turso (LibSQL, edge)", group: "Edge" },
37
+ { type: "dynamodb", label: "DynamoDB (AWS)", group: "Cloud" },
38
+ { type: "supabase", label: "Supabase (managed Postgres)", group: "Cloud" },
39
+ { type: "neon", label: "Neon (serverless Postgres)", group: "Cloud" },
40
+ { type: "planetscale", label: "PlanetScale (managed MySQL)", group: "Cloud" },
41
+ { type: "cockroachdb", label: "CockroachDB", group: "Distributed" }
42
+ ];
43
+ }
44
+
45
+ export {
46
+ createAdapter,
47
+ getSupportedDatabases
48
+ };
@@ -0,0 +1,97 @@
1
+ import {
2
+ DomainLock
3
+ } from "./chunk-UPU23ZRG.js";
4
+ import "./chunk-KFQGP6VL.js";
5
+
6
+ // src/domain-lock/cli-recover.ts
7
+ function getFlag(args, name) {
8
+ const idx = args.indexOf(name);
9
+ if (idx !== -1 && args[idx + 1]) return args[idx + 1];
10
+ return void 0;
11
+ }
12
+ async function runRecover(args) {
13
+ const { default: inquirer } = await import("inquirer");
14
+ const { default: chalk } = await import("chalk");
15
+ const { default: ora } = await import("ora");
16
+ console.log("");
17
+ console.log(chalk.bold(" AgenticMail Enterprise \u2014 Domain Recovery"));
18
+ console.log(chalk.dim(" Recover your domain registration on a new machine."));
19
+ console.log("");
20
+ let domain = getFlag(args, "--domain");
21
+ if (!domain) {
22
+ const answer = await inquirer.prompt([{
23
+ type: "input",
24
+ name: "domain",
25
+ message: "Domain to recover:",
26
+ suffix: chalk.dim(" (e.g. agents.agenticmail.io)"),
27
+ validate: (v) => v.includes(".") || "Enter a valid domain"
28
+ }]);
29
+ domain = answer.domain;
30
+ }
31
+ let key = getFlag(args, "--key");
32
+ if (!key) {
33
+ const answer = await inquirer.prompt([{
34
+ type: "password",
35
+ name: "key",
36
+ message: "Deployment key:",
37
+ mask: "*",
38
+ validate: (v) => {
39
+ if (v.length !== 64) return "Deployment key should be 64 hex characters";
40
+ if (!/^[0-9a-fA-F]+$/.test(v)) return "Deployment key should be hexadecimal";
41
+ return true;
42
+ }
43
+ }]);
44
+ key = answer.key;
45
+ }
46
+ const spinner = ora("Contacting AgenticMail registry...").start();
47
+ const lock = new DomainLock();
48
+ const result = await lock.recover(domain, key);
49
+ if (!result.success) {
50
+ spinner.fail("Recovery failed");
51
+ console.log("");
52
+ console.error(chalk.red(` ${result.error}`));
53
+ console.log("");
54
+ process.exit(1);
55
+ }
56
+ spinner.succeed("Domain recovery initiated");
57
+ const { default: bcrypt } = await import("bcryptjs");
58
+ const keyHash = await bcrypt.hash(key, 12);
59
+ const dbPath = getFlag(args, "--db");
60
+ const dbType = getFlag(args, "--db-type") || "sqlite";
61
+ if (dbPath) {
62
+ try {
63
+ const spinnerDb = ora("Saving to local database...").start();
64
+ const { createAdapter } = await import("./factory-Q67CKNKV.js");
65
+ const db = await createAdapter({ type: dbType, connectionString: dbPath });
66
+ await db.migrate();
67
+ await db.updateSettings({
68
+ domain,
69
+ deploymentKeyHash: keyHash,
70
+ domainRegistrationId: result.registrationId,
71
+ domainDnsChallenge: result.dnsChallenge,
72
+ domainRegisteredAt: (/* @__PURE__ */ new Date()).toISOString(),
73
+ domainStatus: "pending_dns"
74
+ });
75
+ spinnerDb.succeed("Local database updated");
76
+ await db.disconnect();
77
+ } catch (err) {
78
+ console.log(chalk.yellow(`
79
+ Could not update local DB: ${err.message}`));
80
+ console.log(chalk.dim(" You can manually update settings after setup."));
81
+ }
82
+ }
83
+ console.log("");
84
+ console.log(chalk.green.bold(" Domain recovery successful!"));
85
+ console.log("");
86
+ console.log(chalk.bold(" Update your DNS TXT record:"));
87
+ console.log("");
88
+ console.log(` ${chalk.bold("Host:")} ${chalk.cyan(`_agenticmail-verify.${domain}`)}`);
89
+ console.log(` ${chalk.bold("Type:")} ${chalk.cyan("TXT")}`);
90
+ console.log(` ${chalk.bold("Value:")} ${chalk.cyan(result.dnsChallenge)}`);
91
+ console.log("");
92
+ console.log(chalk.dim(" Then run: npx @agenticmail/enterprise verify-domain"));
93
+ console.log("");
94
+ }
95
+ export {
96
+ runRecover
97
+ };
@@ -0,0 +1,98 @@
1
+ import {
2
+ DomainLock
3
+ } from "./chunk-UPU23ZRG.js";
4
+ import "./chunk-KFQGP6VL.js";
5
+
6
+ // src/domain-lock/cli-verify.ts
7
+ function getFlag(args, name) {
8
+ const idx = args.indexOf(name);
9
+ if (idx !== -1 && args[idx + 1]) return args[idx + 1];
10
+ return void 0;
11
+ }
12
+ async function runVerifyDomain(args) {
13
+ const { default: chalk } = await import("chalk");
14
+ const { default: ora } = await import("ora");
15
+ console.log("");
16
+ console.log(chalk.bold(" AgenticMail Enterprise \u2014 Domain Verification"));
17
+ console.log("");
18
+ let domain = getFlag(args, "--domain");
19
+ let dnsChallenge;
20
+ let dbConnected = false;
21
+ let db = null;
22
+ if (!domain) {
23
+ const dbPath = getFlag(args, "--db");
24
+ const dbType = getFlag(args, "--db-type") || "sqlite";
25
+ if (dbPath) {
26
+ try {
27
+ const { createAdapter } = await import("./factory-Q67CKNKV.js");
28
+ db = await createAdapter({ type: dbType, connectionString: dbPath });
29
+ await db.migrate();
30
+ const settings = await db.getSettings();
31
+ domain = settings?.domain;
32
+ dnsChallenge = settings?.domainDnsChallenge;
33
+ dbConnected = true;
34
+ } catch {
35
+ }
36
+ }
37
+ }
38
+ if (!domain) {
39
+ const { default: inquirer } = await import("inquirer");
40
+ const answer = await inquirer.prompt([{
41
+ type: "input",
42
+ name: "domain",
43
+ message: "Domain to verify:",
44
+ suffix: chalk.dim(" (e.g. agents.agenticmail.io)"),
45
+ validate: (v) => v.includes(".") || "Enter a valid domain"
46
+ }]);
47
+ domain = answer.domain;
48
+ }
49
+ const spinner = ora("Checking DNS verification...").start();
50
+ const lock = new DomainLock();
51
+ const result = await lock.checkVerification(domain);
52
+ if (!result.success) {
53
+ spinner.fail("Verification check failed");
54
+ console.log("");
55
+ console.error(chalk.red(` ${result.error}`));
56
+ console.log("");
57
+ if (db) await db.disconnect();
58
+ process.exit(1);
59
+ }
60
+ if (result.verified) {
61
+ spinner.succeed("Domain verified!");
62
+ if (dbConnected && db) {
63
+ try {
64
+ await db.updateSettings({
65
+ domainStatus: "verified",
66
+ domainVerifiedAt: (/* @__PURE__ */ new Date()).toISOString()
67
+ });
68
+ } catch {
69
+ }
70
+ }
71
+ console.log("");
72
+ console.log(chalk.green.bold(` ${domain} is verified and protected.`));
73
+ console.log(chalk.dim(" Your deployment domain is locked. No other instance can claim it."));
74
+ console.log("");
75
+ } else {
76
+ spinner.info("DNS record not found yet");
77
+ console.log("");
78
+ console.log(chalk.yellow(" The DNS TXT record has not been detected."));
79
+ console.log("");
80
+ console.log(chalk.bold(" Make sure this record exists:"));
81
+ console.log("");
82
+ console.log(` ${chalk.bold("Host:")} ${chalk.cyan(`_agenticmail-verify.${domain}`)}`);
83
+ console.log(` ${chalk.bold("Type:")} ${chalk.cyan("TXT")}`);
84
+ if (dnsChallenge) {
85
+ console.log(` ${chalk.bold("Value:")} ${chalk.cyan(dnsChallenge)}`);
86
+ } else {
87
+ console.log(` ${chalk.bold("Value:")} ${chalk.dim("(check your setup records or dashboard)")}`);
88
+ }
89
+ console.log("");
90
+ console.log(chalk.dim(" DNS changes can take up to 48 hours to propagate."));
91
+ console.log(chalk.dim(" Run this command again after adding the record."));
92
+ console.log("");
93
+ }
94
+ if (db) await db.disconnect();
95
+ }
96
+ export {
97
+ runVerifyDomain
98
+ };
package/dist/cli.js CHANGED
@@ -14,10 +14,10 @@ switch (command) {
14
14
  import("./cli-submit-skill-LDFJGSKO.js").then((m) => m.runSubmitSkill(args.slice(1))).catch(fatal);
15
15
  break;
16
16
  case "recover":
17
- import("./cli-recover-SC3WMVKM.js").then((m) => m.runRecover(args.slice(1))).catch(fatal);
17
+ import("./cli-recover-C72I57LB.js").then((m) => m.runRecover(args.slice(1))).catch(fatal);
18
18
  break;
19
19
  case "verify-domain":
20
- import("./cli-verify-7GSJOMRK.js").then((m) => m.runVerifyDomain(args.slice(1))).catch(fatal);
20
+ import("./cli-verify-HKS5O6Q2.js").then((m) => m.runVerifyDomain(args.slice(1))).catch(fatal);
21
21
  break;
22
22
  case "--help":
23
23
  case "-h":
@@ -48,7 +48,7 @@ Skill Development:
48
48
  break;
49
49
  case "setup":
50
50
  default:
51
- import("./setup-SPKFGFRP.js").then((m) => m.runSetupWizard()).catch(fatal);
51
+ import("./setup-DOGWCA3F.js").then((m) => m.runSetupWizard()).catch(fatal);
52
52
  break;
53
53
  }
54
54
  function fatal(err) {
@@ -0,0 +1,9 @@
1
+ import {
2
+ createAdapter,
3
+ getSupportedDatabases
4
+ } from "./chunk-WP76IB36.js";
5
+ import "./chunk-KFQGP6VL.js";
6
+ export {
7
+ createAdapter,
8
+ getSupportedDatabases
9
+ };
package/dist/index.js CHANGED
@@ -50,11 +50,11 @@ import {
50
50
  requireRole,
51
51
  securityHeaders,
52
52
  validate
53
- } from "./chunk-VMRMCEL7.js";
53
+ } from "./chunk-AE3DOUD4.js";
54
54
  import {
55
55
  provision,
56
56
  runSetupWizard
57
- } from "./chunk-M5BY3ZSI.js";
57
+ } from "./chunk-37J6FA4B.js";
58
58
  import {
59
59
  ENGINE_TABLES,
60
60
  ENGINE_TABLES_POSTGRES,
@@ -99,7 +99,7 @@ import {
99
99
  import {
100
100
  createAdapter,
101
101
  getSupportedDatabases
102
- } from "./chunk-M4PRT53C.js";
102
+ } from "./chunk-WP76IB36.js";
103
103
  import {
104
104
  AGENTICMAIL_TOOLS,
105
105
  ALL_TOOLS,