@agenticmail/enterprise 0.5.311 → 0.5.313
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/README.md +682 -544
- package/dist/agent-autonomy-PSXQ4MNP.js +766 -0
- package/dist/agent-heartbeat-6H3YAQ32.js +510 -0
- package/dist/agent-heartbeat-7WS3XILF.js +510 -0
- package/dist/agent-heartbeat-BFGKYUUK.js +510 -0
- package/dist/agent-heartbeat-SSV65YTX.js +510 -0
- package/dist/agent-heartbeat-T5IIHVF4.js +510 -0
- package/dist/agent-heartbeat-X3C6FIU2.js +510 -0
- package/dist/agent-tools-BW6CLQQ7.js +13897 -0
- package/dist/agent-tools-KEA7QEWF.js +13897 -0
- package/dist/agent-tools-NU7V3S5N.js +13899 -0
- package/dist/agent-tools-WINDYRQ2.js +13897 -0
- package/dist/chunk-3ELH5CU6.js +4910 -0
- package/dist/chunk-4QYRS3MS.js +1519 -0
- package/dist/chunk-52REEVDW.js +1519 -0
- package/dist/chunk-5RZJ76YI.js +4977 -0
- package/dist/chunk-6L7FQI5Q.js +4909 -0
- package/dist/chunk-763OMGFI.js +1519 -0
- package/dist/chunk-7ILSXGY6.js +1519 -0
- package/dist/chunk-7UCKD25B.js +551 -0
- package/dist/chunk-A6MSR7DL.js +4977 -0
- package/dist/chunk-ASD2YB6O.js +1519 -0
- package/dist/chunk-AZOIHLLX.js +4977 -0
- package/dist/chunk-BDCFOP7O.js +537 -0
- package/dist/chunk-BSVWPG6I.js +106 -0
- package/dist/chunk-C46DNDZB.js +1519 -0
- package/dist/chunk-CFVTK4FQ.js +4977 -0
- package/dist/chunk-CHJAOKCJ.js +4921 -0
- package/dist/chunk-CYEWTXYH.js +4977 -0
- package/dist/chunk-D3KFSWLK.js +48 -0
- package/dist/chunk-DUVGNAIY.js +4977 -0
- package/dist/chunk-DX4XEFVE.js +25229 -0
- package/dist/chunk-EX6FQSEV.js +167 -0
- package/dist/chunk-F5VZ5EUH.js +1519 -0
- package/dist/chunk-FVUDSPOD.js +4977 -0
- package/dist/chunk-G6FTZKJX.js +4977 -0
- package/dist/chunk-GFEAZN6Y.js +1519 -0
- package/dist/chunk-HKV4FQFW.js +1519 -0
- package/dist/chunk-ICCPULDT.js +25217 -0
- package/dist/chunk-IYEM627Q.js +25216 -0
- package/dist/chunk-JHRJ4QJ6.js +1519 -0
- package/dist/chunk-K2DAUYHV.js +4977 -0
- package/dist/chunk-KDQDSZZQ.js +4973 -0
- package/dist/chunk-LDUD6AZY.js +1519 -0
- package/dist/chunk-LES5TJ5L.js +4909 -0
- package/dist/chunk-MJGGW6MC.js +106 -0
- package/dist/chunk-MQKIWAHQ.js +106 -0
- package/dist/chunk-NGA7BBPF.js +48 -0
- package/dist/chunk-OE3TI4IQ.js +1519 -0
- package/dist/chunk-OHSBIYDR.js +4977 -0
- package/dist/chunk-OPOBUYJT.js +1519 -0
- package/dist/chunk-OZEYDEPB.js +1519 -0
- package/dist/chunk-P4PODSQH.js +1519 -0
- package/dist/chunk-P7UOSFIE.js +636 -0
- package/dist/chunk-PFN6DODU.js +4921 -0
- package/dist/chunk-PKDVM4IY.js +4917 -0
- package/dist/chunk-Q5KG3G7U.js +25115 -0
- package/dist/chunk-QMVNW4FJ.js +25229 -0
- package/dist/chunk-QZ5UPRBE.js +4977 -0
- package/dist/chunk-SPP23N42.js +4977 -0
- package/dist/chunk-SRGHNFOY.js +4921 -0
- package/dist/chunk-TPLVQFXM.js +2594 -0
- package/dist/chunk-U3XYF4QP.js +4977 -0
- package/dist/chunk-VRRJH2DY.js +4921 -0
- package/dist/chunk-WY42BS3F.js +1519 -0
- package/dist/chunk-XAA4VHHZ.js +1519 -0
- package/dist/chunk-Y2KIY4BA.js +4969 -0
- package/dist/chunk-Z5Y5KTPC.js +4977 -0
- package/dist/chunk-ZA4QRACH.js +4977 -0
- package/dist/chunk-ZHLGSTXF.js +4909 -0
- package/dist/cli-agent-26BUULHZ.js +2169 -0
- package/dist/cli-agent-2FLJWXOC.js +2169 -0
- package/dist/cli-agent-4NNQFLO6.js +2255 -0
- package/dist/cli-agent-5WV3EEPW.js +2252 -0
- package/dist/cli-agent-65JUT6DU.js +2193 -0
- package/dist/cli-agent-6HLL7A5K.js +2255 -0
- package/dist/cli-agent-CZ26QWUZ.js +2210 -0
- package/dist/cli-agent-HPVSWDNQ.js +2255 -0
- package/dist/cli-agent-K4SBVG5X.js +2210 -0
- package/dist/cli-agent-K5D424X2.js +2252 -0
- package/dist/cli-agent-U4OL5FGK.js +2210 -0
- package/dist/cli-agent-WUMPOIKQ.js +2169 -0
- package/dist/cli-agent-WWRGGJ2F.js +2255 -0
- package/dist/cli-agent-ZDBBTVGU.js +2193 -0
- package/dist/cli-agent-ZIZ5JP4O.js +2252 -0
- package/dist/cli-recover-I4KNR2OI.js +487 -0
- package/dist/cli-recover-IQTUKWR2.js +487 -0
- package/dist/cli-recover-OYJHELOR.js +487 -0
- package/dist/cli-recover-PVQC7UXB.js +487 -0
- package/dist/cli-recover-T32NABFA.js +487 -0
- package/dist/cli-serve-FE4CMMSN.js +143 -0
- package/dist/cli-serve-FTQJ3RUK.js +143 -0
- package/dist/cli-serve-G4PUCASH.js +143 -0
- package/dist/cli-serve-HBZYUUQ3.js +143 -0
- package/dist/cli-serve-L3NUROMO.js +143 -0
- package/dist/cli-serve-LAA5WIZK.js +143 -0
- package/dist/cli-serve-LV4TUSJD.js +143 -0
- package/dist/cli-serve-MFCTVA2L.js +140 -0
- package/dist/cli-serve-QCRUFI5B.js +143 -0
- package/dist/cli-serve-S7OGQN4P.js +143 -0
- package/dist/cli-serve-SI4BQRXT.js +140 -0
- package/dist/cli-serve-UNB7EHN4.js +143 -0
- package/dist/cli-serve-UV3GVDRD.js +143 -0
- package/dist/cli-serve-V5QICXR5.js +143 -0
- package/dist/cli-serve-VG6Z6GIB.js +143 -0
- package/dist/cli-serve-XSYHPGZI.js +143 -0
- package/dist/cli-serve-Y534FCRV.js +140 -0
- package/dist/cli-verify-CZIITRED.js +149 -0
- package/dist/cli-verify-N73GOKEF.js +149 -0
- package/dist/cli-verify-QEEBZOUZ.js +149 -0
- package/dist/cli-verify-RC5HI6DU.js +149 -0
- package/dist/cli-verify-VKBNIEAX.js +149 -0
- package/dist/cli.js +5 -5
- package/dist/dashboard/app.js +16 -3
- package/dist/dashboard/components/org-switcher.js +5 -1
- package/dist/dashboard/org-switcher.js +156 -0
- package/dist/dashboard/pages/login.js +160 -4
- package/dist/dashboard/pages/task-pipeline.js +1 -1
- package/dist/factory-3IWXVE37.js +9 -0
- package/dist/factory-5M6PTMLC.js +11 -0
- package/dist/factory-CSSHN7GE.js +11 -0
- package/dist/factory-JFWXTAWK.js +11 -0
- package/dist/factory-TBGUYM5X.js +9 -0
- package/dist/google-W5AYGNUJ.js +33 -0
- package/dist/index.js +6 -6
- package/dist/meetings-FJ453ENF.js +12 -0
- package/dist/postgres-BCHZWRU3.js +832 -0
- package/dist/postgres-BI4QVRM6.js +825 -0
- package/dist/postgres-BOTHOPDW.js +875 -0
- package/dist/postgres-JBUKR3TA.js +873 -0
- package/dist/postgres-Z7QYSU6K.js +861 -0
- package/dist/routes-7QYAQTWA.js +90 -0
- package/dist/routes-JCBVZU54.js +90 -0
- package/dist/routes-KEDEJFRE.js +90 -0
- package/dist/routes-WI64ADVH.js +90 -0
- package/dist/routes-X36OSCID.js +90 -0
- package/dist/runtime-75XR6KEW.js +45 -0
- package/dist/runtime-BNM7ZNNL.js +45 -0
- package/dist/runtime-ES6WCJ7D.js +45 -0
- package/dist/runtime-KYJTML2B.js +45 -0
- package/dist/runtime-LO67ZHQA.js +45 -0
- package/dist/runtime-VIXKKVSZ.js +45 -0
- package/dist/runtime-WHWJPCGK.js +45 -0
- package/dist/runtime-Z2Q6GUHH.js +45 -0
- package/dist/runtime-ZZ6CALSB.js +45 -0
- package/dist/server-27A4WEJC.js +28 -0
- package/dist/server-2CBXP4WS.js +28 -0
- package/dist/server-4JQAB5R4.js +28 -0
- package/dist/server-6BOM5U64.js +28 -0
- package/dist/server-CA2I3LJY.js +28 -0
- package/dist/server-FLJKNPRD.js +28 -0
- package/dist/server-HMIHIQ2N.js +28 -0
- package/dist/server-KIXXLR2D.js +28 -0
- package/dist/server-KSEIZTXF.js +28 -0
- package/dist/server-MPVW7DKZ.js +28 -0
- package/dist/server-PRTVRQ2D.js +28 -0
- package/dist/server-SYIG6HAX.js +28 -0
- package/dist/server-U32KDIXC.js +28 -0
- package/dist/server-WFN6CA4T.js +28 -0
- package/dist/server-XQUE3FGT.js +28 -0
- package/dist/server-XWT2UORK.js +28 -0
- package/dist/server-Y3BGNN5Q.js +28 -0
- package/dist/setup-352L2TPS.js +20 -0
- package/dist/setup-4MM645XK.js +20 -0
- package/dist/setup-5JPWW6IP.js +20 -0
- package/dist/setup-CUN6LVUV.js +20 -0
- package/dist/setup-D3YHPWPY.js +20 -0
- package/dist/setup-D4A5I6UM.js +20 -0
- package/dist/setup-DOPLXTB3.js +20 -0
- package/dist/setup-E3NSIM6B.js +20 -0
- package/dist/setup-E3V2D7NL.js +20 -0
- package/dist/setup-FSYPGI2C.js +20 -0
- package/dist/setup-G3RPKRG3.js +20 -0
- package/dist/setup-KJ77HNWK.js +20 -0
- package/dist/setup-LPSOY5V5.js +20 -0
- package/dist/setup-N3ODDSQE.js +20 -0
- package/dist/setup-NLDM3M2P.js +20 -0
- package/dist/setup-PT6WGOYB.js +20 -0
- package/dist/setup-SWJMNDWF.js +20 -0
- package/dist/system-prompts-6OUTAMH6.js +41 -0
- package/dist/task-queue-YP2I54IA.js +9 -0
- package/dist/telegram-QRNGRT5M.js +17 -0
- package/dist/whatsapp-VYVINCGV.js +31 -0
- package/god_is_great.html +35 -0
- package/package.json +1 -1
- package/src/admin/routes.ts +24 -4
- package/src/agent-tools/index.ts +4 -1
- package/src/agent-tools/tool-resolver.ts +15 -4
- package/src/agent-tools/tools/browser.ts +2 -2
- package/src/agent-tools/tools/local/dependency-manager.ts +286 -0
- package/src/agent-tools/tools/local/index.ts +3 -0
- package/src/agent-tools/tools/messaging/telegram.ts +29 -0
- package/src/agent-tools/tools/messaging/whatsapp.ts +59 -4
- package/src/auth/routes.ts +15 -12
- package/src/cli-agent.ts +47 -6
- package/src/cli-serve.ts +2 -5
- package/src/dashboard/app.js +16 -3
- package/src/dashboard/components/org-switcher.js +5 -1
- package/src/dashboard/pages/login.js +160 -4
- package/src/dashboard/pages/task-pipeline.js +1 -1
- package/src/db/adapter.ts +2 -0
- package/src/db/factory.ts +78 -0
- package/src/db/postgres.ts +57 -12
- package/src/engine/agent-autonomy.ts +1 -1
- package/src/engine/agent-heartbeat.ts +1 -1
- package/src/engine/messaging-poller.ts +146 -11
- package/src/engine/oauth-connect-routes.ts +23 -3
- package/src/engine/routes.ts +1 -1
- package/src/engine/task-poller.ts +54 -3
- package/src/engine/task-queue.ts +30 -0
- package/src/runtime/index.ts +2 -1
- package/src/runtime/types.ts +2 -0
- package/src/server.ts +43 -1
- package/src/system-prompts/triage.ts +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
function hasFlag(args, name) {
|
|
13
|
+
return args.includes(name);
|
|
14
|
+
}
|
|
15
|
+
function detectDbType(url) {
|
|
16
|
+
const u = url.toLowerCase().trim();
|
|
17
|
+
if (u.startsWith("postgres") || u.startsWith("pg:")) return "postgres";
|
|
18
|
+
if (u.startsWith("mysql")) return "mysql";
|
|
19
|
+
if (u.startsWith("mongodb")) return "mongodb";
|
|
20
|
+
if (u.startsWith("libsql") || u.includes(".turso.io")) return "turso";
|
|
21
|
+
if (u.endsWith(".db") || u.endsWith(".sqlite") || u.endsWith(".sqlite3") || u.startsWith("file:")) return "sqlite";
|
|
22
|
+
return "postgres";
|
|
23
|
+
}
|
|
24
|
+
async function runVerifyDomain(args) {
|
|
25
|
+
const { default: chalk } = await import("chalk");
|
|
26
|
+
const { default: ora } = await import("ora");
|
|
27
|
+
console.log("");
|
|
28
|
+
console.log(chalk.bold(" AgenticMail Enterprise \u2014 Domain Verification"));
|
|
29
|
+
console.log("");
|
|
30
|
+
let domain = getFlag(args, "--domain");
|
|
31
|
+
let dnsChallenge;
|
|
32
|
+
let db = null;
|
|
33
|
+
let dbConnected = false;
|
|
34
|
+
const envDbUrl = process.env.DATABASE_URL;
|
|
35
|
+
if (envDbUrl) {
|
|
36
|
+
const dbType = detectDbType(envDbUrl);
|
|
37
|
+
const spinner = ora(`Connecting to database (${dbType})...`).start();
|
|
38
|
+
try {
|
|
39
|
+
const { createAdapter } = await import("./factory-TBGUYM5X.js");
|
|
40
|
+
db = await createAdapter({ type: dbType, connectionString: envDbUrl });
|
|
41
|
+
await db.migrate();
|
|
42
|
+
const settings = await db.getSettings();
|
|
43
|
+
if (!domain && settings?.domain) domain = settings.domain;
|
|
44
|
+
if (settings?.domainDnsChallenge) dnsChallenge = settings.domainDnsChallenge;
|
|
45
|
+
dbConnected = true;
|
|
46
|
+
spinner.succeed(`Connected to ${dbType} database` + (domain ? ` (domain: ${domain})` : ""));
|
|
47
|
+
} catch (err) {
|
|
48
|
+
spinner.warn(`Could not connect via DATABASE_URL: ${err.message}`);
|
|
49
|
+
db = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!dbConnected) {
|
|
53
|
+
const dbPath = getFlag(args, "--db");
|
|
54
|
+
const dbType = getFlag(args, "--db-type") || "sqlite";
|
|
55
|
+
if (dbPath) {
|
|
56
|
+
const spinner = ora(`Connecting to ${dbType} database...`).start();
|
|
57
|
+
try {
|
|
58
|
+
const { createAdapter } = await import("./factory-TBGUYM5X.js");
|
|
59
|
+
db = await createAdapter({ type: dbType, connectionString: dbPath });
|
|
60
|
+
await db.migrate();
|
|
61
|
+
const settings = await db.getSettings();
|
|
62
|
+
if (!domain && settings?.domain) domain = settings.domain;
|
|
63
|
+
if (settings?.domainDnsChallenge) dnsChallenge = settings.domainDnsChallenge;
|
|
64
|
+
dbConnected = true;
|
|
65
|
+
spinner.succeed(`Connected to ${dbType} database`);
|
|
66
|
+
} catch {
|
|
67
|
+
spinner.warn("Could not read local database");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!domain) {
|
|
72
|
+
const { default: inquirer } = await import("inquirer");
|
|
73
|
+
const answer = await inquirer.prompt([{
|
|
74
|
+
type: "input",
|
|
75
|
+
name: "domain",
|
|
76
|
+
message: "Domain to verify:",
|
|
77
|
+
suffix: chalk.dim(" (e.g. agents.yourcompany.com)"),
|
|
78
|
+
validate: (v) => v.includes(".") || "Enter a valid domain",
|
|
79
|
+
filter: (v) => v.trim().toLowerCase()
|
|
80
|
+
}]);
|
|
81
|
+
domain = answer.domain;
|
|
82
|
+
}
|
|
83
|
+
const lock = new DomainLock();
|
|
84
|
+
const maxAttempts = hasFlag(args, "--poll") ? 5 : 1;
|
|
85
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
86
|
+
const spinner = ora(
|
|
87
|
+
maxAttempts > 1 ? `Checking DNS verification (attempt ${attempt}/${maxAttempts})...` : "Checking DNS verification..."
|
|
88
|
+
).start();
|
|
89
|
+
try {
|
|
90
|
+
const result = await lock.checkVerification(domain);
|
|
91
|
+
if (!result.success) {
|
|
92
|
+
spinner.fail("Verification check failed");
|
|
93
|
+
console.log("");
|
|
94
|
+
console.error(chalk.red(` ${result.error}`));
|
|
95
|
+
console.log("");
|
|
96
|
+
if (db) await db.disconnect();
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
if (result.verified) {
|
|
100
|
+
spinner.succeed("Domain verified!");
|
|
101
|
+
if (dbConnected && db) {
|
|
102
|
+
try {
|
|
103
|
+
await db.updateSettings({
|
|
104
|
+
domainStatus: "verified",
|
|
105
|
+
domainVerifiedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
106
|
+
});
|
|
107
|
+
console.log(chalk.dim(" Database updated with verified status."));
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
console.log("");
|
|
112
|
+
console.log(chalk.green.bold(` \u2713 ${domain} is verified and protected.`));
|
|
113
|
+
console.log(chalk.dim(" Your deployment domain is locked. No other instance can claim it."));
|
|
114
|
+
console.log(chalk.dim(" The system now operates 100% offline \u2014 no outbound calls are made."));
|
|
115
|
+
console.log("");
|
|
116
|
+
if (db) await db.disconnect();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
} catch (err) {
|
|
120
|
+
spinner.warn(`Check failed: ${err.message}`);
|
|
121
|
+
}
|
|
122
|
+
if (attempt < maxAttempts) {
|
|
123
|
+
const waitSpinner = ora(`DNS record not found yet. Retrying in 10 seconds...`).start();
|
|
124
|
+
await new Promise((r) => setTimeout(r, 1e4));
|
|
125
|
+
waitSpinner.stop();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
console.log("");
|
|
129
|
+
console.log(chalk.yellow(" DNS record not detected yet."));
|
|
130
|
+
console.log("");
|
|
131
|
+
console.log(chalk.bold(" Make sure this TXT record exists at your DNS provider:"));
|
|
132
|
+
console.log("");
|
|
133
|
+
console.log(` ${chalk.bold("Host:")} ${chalk.cyan(`_agenticmail-verify.${domain}`)}`);
|
|
134
|
+
console.log(` ${chalk.bold("Type:")} ${chalk.cyan("TXT")}`);
|
|
135
|
+
if (dnsChallenge) {
|
|
136
|
+
console.log(` ${chalk.bold("Value:")} ${chalk.cyan(dnsChallenge)}`);
|
|
137
|
+
} else {
|
|
138
|
+
console.log(` ${chalk.bold("Value:")} ${chalk.dim("(check your dashboard or setup output)")}`);
|
|
139
|
+
}
|
|
140
|
+
console.log("");
|
|
141
|
+
console.log(chalk.dim(" DNS propagation can take up to 48 hours."));
|
|
142
|
+
console.log(chalk.dim(" Run with --poll to retry automatically:"));
|
|
143
|
+
console.log(chalk.dim(` npx @agenticmail/enterprise verify-domain --domain ${domain} --poll`));
|
|
144
|
+
console.log("");
|
|
145
|
+
if (db) await db.disconnect();
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
runVerifyDomain
|
|
149
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -14,10 +14,10 @@ switch (command) {
|
|
|
14
14
|
import("./cli-submit-skill-SNGAHVB7.js").then((m) => m.runSubmitSkill(args.slice(1))).catch(fatal);
|
|
15
15
|
break;
|
|
16
16
|
case "recover":
|
|
17
|
-
import("./cli-recover-
|
|
17
|
+
import("./cli-recover-T32NABFA.js").then((m) => m.runRecover(args.slice(1))).catch(fatal);
|
|
18
18
|
break;
|
|
19
19
|
case "verify-domain":
|
|
20
|
-
import("./cli-verify-
|
|
20
|
+
import("./cli-verify-CZIITRED.js").then((m) => m.runVerifyDomain(args.slice(1))).catch(fatal);
|
|
21
21
|
break;
|
|
22
22
|
case "reset-password":
|
|
23
23
|
import("./cli-reset-password-SO5Y6MW7.js").then((m) => m.runResetPassword(args.slice(1))).catch(fatal);
|
|
@@ -57,14 +57,14 @@ Skill Development:
|
|
|
57
57
|
break;
|
|
58
58
|
case "serve":
|
|
59
59
|
case "start":
|
|
60
|
-
import("./cli-serve-
|
|
60
|
+
import("./cli-serve-Y534FCRV.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
|
|
61
61
|
break;
|
|
62
62
|
case "agent":
|
|
63
|
-
import("./cli-agent-
|
|
63
|
+
import("./cli-agent-5WV3EEPW.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
|
|
64
64
|
break;
|
|
65
65
|
case "setup":
|
|
66
66
|
default:
|
|
67
|
-
import("./setup-
|
|
67
|
+
import("./setup-N3ODDSQE.js").then((m) => m.runSetupWizard()).catch(fatal);
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
function fatal(err) {
|
package/dist/dashboard/app.js
CHANGED
|
@@ -163,6 +163,12 @@ function App() {
|
|
|
163
163
|
if (document.cookie.match(/em_session|em_csrf/)) {
|
|
164
164
|
authCall('/me').then(async d => {
|
|
165
165
|
setUser(d.user || d);
|
|
166
|
+
// If user is org-bound, lock org context immediately
|
|
167
|
+
var u = d.user || d;
|
|
168
|
+
if (u.clientOrgId) {
|
|
169
|
+
setSelectedOrgId(u.clientOrgId);
|
|
170
|
+
localStorage.setItem('em_client_org_id', u.clientOrgId);
|
|
171
|
+
}
|
|
166
172
|
// Init transport encryption BEFORE setting authed — ensures all subsequent
|
|
167
173
|
// API calls from child components are encrypted
|
|
168
174
|
try {
|
|
@@ -202,9 +208,10 @@ function App() {
|
|
|
202
208
|
apiCall('/settings').then(d => { const s = d.settings || d || {}; if (s.primaryColor) applyBrandColor(s.primaryColor); if (s.orgId) setOrgId(s.orgId); }).catch(() => {});
|
|
203
209
|
apiCall('/me/permissions').then(d => {
|
|
204
210
|
if (d && d.permissions) setPermissions(d.permissions);
|
|
205
|
-
// If user is assigned to a client org, auto-set org context
|
|
211
|
+
// If user is assigned to a client org, auto-set org context and lock switcher
|
|
206
212
|
if (d && d.clientOrgId) {
|
|
207
213
|
localStorage.setItem('em_client_org_id', d.clientOrgId);
|
|
214
|
+
setSelectedOrgId(d.clientOrgId);
|
|
208
215
|
} else {
|
|
209
216
|
localStorage.removeItem('em_client_org_id');
|
|
210
217
|
}
|
|
@@ -230,10 +237,15 @@ function App() {
|
|
|
230
237
|
if (d.user.permissions) setPermissions(d.user.permissions);
|
|
231
238
|
if (d.user.clientOrgId) {
|
|
232
239
|
localStorage.setItem('em_client_org_id', d.user.clientOrgId);
|
|
240
|
+
// Auto-select the client org so all pages filter by it
|
|
241
|
+
onOrgChange(d.user.clientOrgId, null);
|
|
233
242
|
apiCall('/organizations/' + d.user.clientOrgId).then(function(o) {
|
|
234
|
-
if (o && o.name)
|
|
243
|
+
if (o && o.name) {
|
|
244
|
+
setImpersonating(function(prev) { return prev ? Object.assign({}, prev, { user: Object.assign({}, prev.user, { clientOrgName: o.name }) }) : prev; });
|
|
245
|
+
onOrgChange(d.user.clientOrgId, o);
|
|
246
|
+
}
|
|
235
247
|
}).catch(function() {});
|
|
236
|
-
} else localStorage.removeItem('em_client_org_id');
|
|
248
|
+
} else { localStorage.removeItem('em_client_org_id'); onOrgChange('', null); }
|
|
237
249
|
toast('Now viewing as ' + d.user.name, 'info');
|
|
238
250
|
setPage('dashboard');
|
|
239
251
|
}
|
|
@@ -248,6 +260,7 @@ function App() {
|
|
|
248
260
|
return null;
|
|
249
261
|
});
|
|
250
262
|
localStorage.removeItem('em_client_org_id');
|
|
263
|
+
onOrgChange('', null); // Reset org selection back to platform org
|
|
251
264
|
authCall('/me').then(d => { setUser(d.user || d); }).catch(() => {});
|
|
252
265
|
apiCall('/me/permissions').then(d => { if (d && d.permissions) setPermissions(d.permissions); }).catch(() => {});
|
|
253
266
|
toast('Stopped impersonation', 'success');
|
|
@@ -136,7 +136,11 @@ export function OrgContextSwitcher(props) {
|
|
|
136
136
|
*/
|
|
137
137
|
export function useOrgContext() {
|
|
138
138
|
var app = useApp();
|
|
139
|
-
var
|
|
139
|
+
var user = app.user || {};
|
|
140
|
+
var userClientOrgId = user.clientOrgId || null;
|
|
141
|
+
var isLocked = !!userClientOrgId && user.role !== 'owner' && user.role !== 'admin';
|
|
142
|
+
// If user is org-bound (locked), always use their clientOrgId regardless of selectedOrgId
|
|
143
|
+
var selectedOrgId = isLocked ? userClientOrgId : (app.selectedOrgId || '');
|
|
140
144
|
var selectedOrg = app.selectedOrg || null;
|
|
141
145
|
var onOrgChange = app.onOrgChange || function() {};
|
|
142
146
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { h, useState, useEffect, useCallback, useRef, Fragment, apiCall, useApp } from './utils.js';
|
|
2
|
+
import { I } from './icons.js';
|
|
3
|
+
|
|
4
|
+
// ─── Global org cache (shared across all switcher instances) ────────
|
|
5
|
+
var _orgCache = { orgs: null, loading: false, listeners: [], lastFetch: 0 };
|
|
6
|
+
var ORG_CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
|
7
|
+
|
|
8
|
+
function getOrgsFromCache(forceRefresh) {
|
|
9
|
+
var now = Date.now();
|
|
10
|
+
// Return cached if fresh
|
|
11
|
+
if (!forceRefresh && _orgCache.orgs && (now - _orgCache.lastFetch) < ORG_CACHE_TTL) {
|
|
12
|
+
return Promise.resolve(_orgCache.orgs);
|
|
13
|
+
}
|
|
14
|
+
// Already loading — wait for it
|
|
15
|
+
if (_orgCache.loading) {
|
|
16
|
+
return new Promise(function(resolve) {
|
|
17
|
+
_orgCache.listeners.push(resolve);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// Fetch
|
|
21
|
+
_orgCache.loading = true;
|
|
22
|
+
return apiCall('/organizations').then(function(d) {
|
|
23
|
+
var list = d.organizations || [];
|
|
24
|
+
_orgCache.orgs = list;
|
|
25
|
+
_orgCache.lastFetch = Date.now();
|
|
26
|
+
_orgCache.loading = false;
|
|
27
|
+
// Notify waiters
|
|
28
|
+
var listeners = _orgCache.listeners;
|
|
29
|
+
_orgCache.listeners = [];
|
|
30
|
+
listeners.forEach(function(fn) { fn(list); });
|
|
31
|
+
return list;
|
|
32
|
+
}).catch(function() {
|
|
33
|
+
_orgCache.loading = false;
|
|
34
|
+
_orgCache.orgs = _orgCache.orgs || [];
|
|
35
|
+
var listeners = _orgCache.listeners;
|
|
36
|
+
_orgCache.listeners = [];
|
|
37
|
+
listeners.forEach(function(fn) { fn(_orgCache.orgs || []); });
|
|
38
|
+
return _orgCache.orgs || [];
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Invalidate org cache (call after creating/deleting orgs) */
|
|
43
|
+
export function invalidateOrgCache() {
|
|
44
|
+
_orgCache.orgs = null;
|
|
45
|
+
_orgCache.lastFetch = 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* OrgContextSwitcher — Global org context picker for multi-tenant pages.
|
|
50
|
+
*
|
|
51
|
+
* If the current user has a clientOrgId, the switcher is LOCKED to that org
|
|
52
|
+
* (they can only see their org's data). Owners/admins can switch freely.
|
|
53
|
+
*
|
|
54
|
+
* Uses a global cache so /organizations is only fetched once across all pages.
|
|
55
|
+
*/
|
|
56
|
+
export function OrgContextSwitcher(props) {
|
|
57
|
+
var onOrgChange = props.onOrgChange;
|
|
58
|
+
var selectedOrgId = props.selectedOrgId || '';
|
|
59
|
+
var showLabel = props.showLabel !== false;
|
|
60
|
+
var style = props.style || {};
|
|
61
|
+
|
|
62
|
+
var app = useApp();
|
|
63
|
+
var user = app.user || {};
|
|
64
|
+
var userOrgId = user.clientOrgId || null;
|
|
65
|
+
var isLocked = !!userOrgId && user.role !== 'owner' && user.role !== 'admin';
|
|
66
|
+
|
|
67
|
+
var _orgs = useState(_orgCache.orgs || []);
|
|
68
|
+
var orgs = _orgs[0]; var setOrgs = _orgs[1];
|
|
69
|
+
var _loaded = useState(!!_orgCache.orgs);
|
|
70
|
+
var loaded = _loaded[0]; var setLoaded = _loaded[1];
|
|
71
|
+
|
|
72
|
+
useEffect(function() {
|
|
73
|
+
// If already cached, use immediately (no API call)
|
|
74
|
+
if (_orgCache.orgs && (Date.now() - _orgCache.lastFetch) < ORG_CACHE_TTL) {
|
|
75
|
+
setOrgs(_orgCache.orgs);
|
|
76
|
+
setLoaded(true);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
getOrgsFromCache(false).then(function(list) {
|
|
80
|
+
setOrgs(list);
|
|
81
|
+
setLoaded(true);
|
|
82
|
+
});
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
// Don't render if no client orgs and user isn't org-bound
|
|
86
|
+
if (loaded && orgs.length === 0 && !userOrgId) return null;
|
|
87
|
+
if (!loaded) return null;
|
|
88
|
+
|
|
89
|
+
var effectiveId = isLocked ? userOrgId : selectedOrgId;
|
|
90
|
+
var selectedOrg = orgs.find(function(o) { return o.id === effectiveId; });
|
|
91
|
+
|
|
92
|
+
return h('div', {
|
|
93
|
+
style: Object.assign({
|
|
94
|
+
display: 'flex', alignItems: 'center', gap: 10, padding: '8px 14px',
|
|
95
|
+
background: 'var(--bg-tertiary)', border: '1px solid var(--border)',
|
|
96
|
+
borderRadius: 'var(--radius, 8px)',
|
|
97
|
+
marginBottom: 16, fontSize: 13
|
|
98
|
+
}, style)
|
|
99
|
+
},
|
|
100
|
+
showLabel && h('span', { style: { color: 'var(--text-muted)', fontWeight: 600, whiteSpace: 'nowrap' } }, I.building(), ' Viewing:'),
|
|
101
|
+
isLocked
|
|
102
|
+
? h('div', { style: { fontWeight: 600, fontSize: 13, color: 'var(--text)', display: 'flex', alignItems: 'center', gap: 6 } },
|
|
103
|
+
selectedOrg ? selectedOrg.name : 'Your Organization',
|
|
104
|
+
h('span', { className: 'badge badge-neutral', style: { fontSize: 10 } }, 'Locked')
|
|
105
|
+
)
|
|
106
|
+
: h('select', {
|
|
107
|
+
value: selectedOrgId,
|
|
108
|
+
onChange: function(e) {
|
|
109
|
+
var id = e.target.value;
|
|
110
|
+
var org = orgs.find(function(o) { return o.id === id; });
|
|
111
|
+
onOrgChange(id, org || null);
|
|
112
|
+
},
|
|
113
|
+
style: {
|
|
114
|
+
padding: '6px 10px', borderRadius: 6, border: '1px solid var(--border)',
|
|
115
|
+
background: 'var(--bg-card)', color: 'var(--text)', fontSize: 13,
|
|
116
|
+
cursor: 'pointer', fontWeight: 600, flex: 1, maxWidth: 300
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
h('option', { value: '' }, 'My Organization'),
|
|
120
|
+
orgs.filter(function(o) { return o.is_active !== false; }).map(function(o) {
|
|
121
|
+
return h('option', { key: o.id, value: o.id }, o.name + (o.billing_rate_per_agent > 0 ? ' (' + (o.currency || 'USD') + ' ' + parseFloat(o.billing_rate_per_agent).toFixed(0) + '/agent)' : ''));
|
|
122
|
+
})
|
|
123
|
+
),
|
|
124
|
+
selectedOrg && h('span', { style: { fontSize: 11, color: 'var(--text-muted)' } },
|
|
125
|
+
selectedOrg.contact_name ? selectedOrg.contact_name : '',
|
|
126
|
+
selectedOrg.contact_email ? ' \u2022 ' + selectedOrg.contact_email : ''
|
|
127
|
+
),
|
|
128
|
+
// Impersonation banner
|
|
129
|
+
app.impersonating && h('span', { className: 'badge badge-warning', style: { fontSize: 10, marginLeft: 'auto' } }, 'Impersonating: ' + (user.name || user.email))
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* useOrgContext — Hook that provides org switching state.
|
|
135
|
+
* Auto-selects the user's client org if they are org-bound.
|
|
136
|
+
*/
|
|
137
|
+
export function useOrgContext() {
|
|
138
|
+
var app = useApp();
|
|
139
|
+
var user = app.user || {};
|
|
140
|
+
var userClientOrgId = user.clientOrgId || null;
|
|
141
|
+
var isLocked = !!userClientOrgId && user.role !== 'owner' && user.role !== 'admin';
|
|
142
|
+
// If user is org-bound (locked), always use their clientOrgId regardless of selectedOrgId
|
|
143
|
+
var selectedOrgId = isLocked ? userClientOrgId : (app.selectedOrgId || '');
|
|
144
|
+
var selectedOrg = app.selectedOrg || null;
|
|
145
|
+
var onOrgChange = app.onOrgChange || function() {};
|
|
146
|
+
|
|
147
|
+
// Stable Switcher reference
|
|
148
|
+
var Switcher = useCallback(function(extraProps) {
|
|
149
|
+
return h(OrgContextSwitcher, Object.assign({
|
|
150
|
+
selectedOrgId: selectedOrgId,
|
|
151
|
+
onOrgChange: onOrgChange
|
|
152
|
+
}, extraProps || {}));
|
|
153
|
+
}, [selectedOrgId, onOrgChange]);
|
|
154
|
+
|
|
155
|
+
return { selectedOrgId: selectedOrgId, selectedOrg: selectedOrg, onOrgChange: onOrgChange, Switcher: Switcher };
|
|
156
|
+
}
|
|
@@ -382,6 +382,118 @@ export function OnboardingWizard({ onComplete }) {
|
|
|
382
382
|
|
|
383
383
|
var set = function(k, v) { setForm(function(f) { return Object.assign({}, f, { [k]: v }); }); };
|
|
384
384
|
|
|
385
|
+
// ─── Smart DB URL Analysis & Auto-Optimization ─────
|
|
386
|
+
|
|
387
|
+
var analyzeDbUrl = function(url) {
|
|
388
|
+
if (!url) return null;
|
|
389
|
+
try {
|
|
390
|
+
var u = new URL(url);
|
|
391
|
+
var port = u.port || '5432';
|
|
392
|
+
var host = u.hostname || '';
|
|
393
|
+
var info = {
|
|
394
|
+
host: host, port: port, provider: null, isPooler: false, poolerMode: null,
|
|
395
|
+
directUrl: null, optimizedUrl: null, warnings: [], tips: [], autoFixed: []
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// ── Supabase Detection ──────────────────────────
|
|
399
|
+
if (host.includes('.supabase.co') || host.includes('pooler.supabase.com')) {
|
|
400
|
+
info.provider = 'supabase';
|
|
401
|
+
var projectRef = u.username.replace('postgres.', '');
|
|
402
|
+
|
|
403
|
+
if (host.includes('pooler.supabase.com')) {
|
|
404
|
+
info.isPooler = true;
|
|
405
|
+
info.poolerMode = port === '6543' ? 'transaction' : port === '5432' ? 'session' : 'unknown';
|
|
406
|
+
|
|
407
|
+
// Build direct URL: db.{ref}.supabase.co:5432
|
|
408
|
+
var directU = new URL(url);
|
|
409
|
+
directU.hostname = 'db.' + projectRef + '.supabase.co';
|
|
410
|
+
directU.port = '5432';
|
|
411
|
+
directU.searchParams.delete('pgbouncer');
|
|
412
|
+
info.directUrl = directU.toString();
|
|
413
|
+
|
|
414
|
+
if (port === '5432') {
|
|
415
|
+
// Auto-fix: switch from session mode (5432) to transaction mode (6543)
|
|
416
|
+
var fixedU = new URL(url);
|
|
417
|
+
fixedU.port = '6543';
|
|
418
|
+
fixedU.searchParams.set('pgbouncer', 'true');
|
|
419
|
+
info.optimizedUrl = fixedU.toString();
|
|
420
|
+
info.autoFixed.push('Switched from session mode (port 5432) to transaction mode (port 6543) — higher connection limits and better for multi-process setups.');
|
|
421
|
+
info.autoFixed.push('Added ?pgbouncer=true for proper connection pooling.');
|
|
422
|
+
} else if (port === '6543') {
|
|
423
|
+
// Already on transaction mode — ensure pgbouncer param is set
|
|
424
|
+
if (!u.searchParams.get('pgbouncer')) {
|
|
425
|
+
var optU = new URL(url);
|
|
426
|
+
optU.searchParams.set('pgbouncer', 'true');
|
|
427
|
+
info.optimizedUrl = optU.toString();
|
|
428
|
+
info.autoFixed.push('Added ?pgbouncer=true parameter for proper PgBouncer transaction mode handling.');
|
|
429
|
+
}
|
|
430
|
+
info.tips.push('Transaction mode pooler detected — optimal for production.');
|
|
431
|
+
}
|
|
432
|
+
info.tips.push('Direct URL auto-generated for migrations (bypasses pooler for DDL operations).');
|
|
433
|
+
|
|
434
|
+
} else if (host.startsWith('db.') || host.includes('.supabase.co')) {
|
|
435
|
+
// Direct connection — build pooler URL for them
|
|
436
|
+
info.directUrl = url;
|
|
437
|
+
var region = host.match(/db\.([^.]+)\.supabase\.co/)?.[1] || projectRef;
|
|
438
|
+
// Try to detect region from hostname pattern
|
|
439
|
+
var poolerU = new URL(url);
|
|
440
|
+
// Supabase pooler format: aws-0-{region}.pooler.supabase.com
|
|
441
|
+
poolerU.hostname = 'aws-0-us-east-1.pooler.supabase.com'; // default, user may need to adjust
|
|
442
|
+
poolerU.port = '6543';
|
|
443
|
+
poolerU.username = 'postgres.' + region;
|
|
444
|
+
poolerU.searchParams.set('pgbouncer', 'true');
|
|
445
|
+
info.warnings.push('Direct connection detected. For production with multiple agents, use the Supabase connection pooler.');
|
|
446
|
+
info.tips.push('Go to Supabase Dashboard > Settings > Database > Connection string > URI, and select "Transaction mode" to get the correct pooler URL.');
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
// ── Neon Detection ──────────────────────────────
|
|
450
|
+
else if (host.includes('.neon.tech')) {
|
|
451
|
+
info.provider = 'neon';
|
|
452
|
+
info.isPooler = host.includes('-pooler');
|
|
453
|
+
if (!info.isPooler) {
|
|
454
|
+
// Auto-fix: add -pooler to hostname
|
|
455
|
+
var neonFixedU = new URL(url);
|
|
456
|
+
var parts = neonFixedU.hostname.split('.');
|
|
457
|
+
if (parts[0] && !parts[0].endsWith('-pooler')) {
|
|
458
|
+
parts[0] = parts[0] + '-pooler';
|
|
459
|
+
neonFixedU.hostname = parts.join('.');
|
|
460
|
+
info.optimizedUrl = neonFixedU.toString();
|
|
461
|
+
info.autoFixed.push('Added connection pooler endpoint (-pooler) for better connection handling.');
|
|
462
|
+
}
|
|
463
|
+
// Direct URL is the original
|
|
464
|
+
info.directUrl = url;
|
|
465
|
+
info.tips.push('Direct URL saved for migrations.');
|
|
466
|
+
} else {
|
|
467
|
+
// Already pooled — generate direct URL
|
|
468
|
+
var neonDirectU = new URL(url);
|
|
469
|
+
var neonParts = neonDirectU.hostname.split('.');
|
|
470
|
+
if (neonParts[0]) {
|
|
471
|
+
neonParts[0] = neonParts[0].replace(/-pooler$/, '');
|
|
472
|
+
neonDirectU.hostname = neonParts.join('.');
|
|
473
|
+
}
|
|
474
|
+
info.directUrl = neonDirectU.toString();
|
|
475
|
+
info.tips.push('Neon pooler detected — optimal for production. Direct URL auto-generated for migrations.');
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
// ── Generic Postgres ────────────────────────────
|
|
479
|
+
else {
|
|
480
|
+
info.provider = 'postgres';
|
|
481
|
+
// Check for common PgBouncer indicators
|
|
482
|
+
if (port === '6432' || port === '6543' || u.searchParams.get('pgbouncer') === 'true') {
|
|
483
|
+
info.isPooler = true;
|
|
484
|
+
info.poolerMode = 'transaction';
|
|
485
|
+
info.tips.push('PgBouncer detected. Connection pooling will be configured automatically.');
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return info;
|
|
490
|
+
} catch { return null; }
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
var dbUrlInfo = useMemo(function() {
|
|
494
|
+
return analyzeDbUrl(form.dbConnectionString);
|
|
495
|
+
}, [form.dbConnectionString]);
|
|
496
|
+
|
|
385
497
|
// ─── DB Config Builder ──────────────────────────────
|
|
386
498
|
|
|
387
499
|
var buildDbConfig = function() {
|
|
@@ -389,7 +501,17 @@ export function OnboardingWizard({ onComplete }) {
|
|
|
389
501
|
if (t === 'sqlite') return { type: 'sqlite' };
|
|
390
502
|
if (t === 'turso') return { type: 'turso', connectionString: form.dbConnectionString, authToken: form.dbAuthToken };
|
|
391
503
|
if (t === 'dynamodb') return { type: 'dynamodb', region: form.dbRegion, accessKeyId: form.dbAccessKey, secretAccessKey: form.dbSecretKey };
|
|
392
|
-
|
|
504
|
+
// Use optimized URL if available (auto-fixed pooler mode, pgbouncer param, etc.)
|
|
505
|
+
var connStr = (dbUrlInfo && dbUrlInfo.optimizedUrl) ? dbUrlInfo.optimizedUrl : form.dbConnectionString;
|
|
506
|
+
var config = { type: t, connectionString: connStr };
|
|
507
|
+
// Auto-attach smart DB metadata for Postgres-family databases
|
|
508
|
+
if (dbUrlInfo) {
|
|
509
|
+
config.poolerDetected = dbUrlInfo.isPooler || !!dbUrlInfo.optimizedUrl;
|
|
510
|
+
config.poolerMode = dbUrlInfo.poolerMode || (dbUrlInfo.optimizedUrl ? 'transaction' : null);
|
|
511
|
+
config.directUrl = dbUrlInfo.directUrl;
|
|
512
|
+
config.provider = dbUrlInfo.provider;
|
|
513
|
+
}
|
|
514
|
+
return config;
|
|
393
515
|
};
|
|
394
516
|
|
|
395
517
|
// ─── Actions ────────────────────────────────────────
|
|
@@ -528,9 +650,43 @@ export function OnboardingWizard({ onComplete }) {
|
|
|
528
650
|
);
|
|
529
651
|
}
|
|
530
652
|
// Connection string types: postgres, mysql, mongodb, supabase, neon, planetscale, cockroachdb
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
h('
|
|
653
|
+
var urlHints = dbUrlInfo && form.dbConnectionString.length > 10;
|
|
654
|
+
return h(Fragment, null,
|
|
655
|
+
h('div', { className: 'form-group' },
|
|
656
|
+
h('label', { className: 'form-label' }, 'Connection String'),
|
|
657
|
+
h('input', { className: 'input', value: form.dbConnectionString, onChange: function(e) { set('dbConnectionString', e.target.value); }, placeholder: currentDbType ? currentDbType.placeholder : '' })
|
|
658
|
+
),
|
|
659
|
+
// Smart URL analysis hints
|
|
660
|
+
urlHints && h('div', { style: { margin: '-8px 0 12px', fontSize: 12, lineHeight: 1.6 } },
|
|
661
|
+
dbUrlInfo.provider && dbUrlInfo.provider !== 'postgres' && h('div', { style: { color: 'var(--accent)', fontWeight: 500, marginBottom: 4 } },
|
|
662
|
+
dbUrlInfo.provider === 'supabase' ? '\uD83D\uDFE2 Supabase' : dbUrlInfo.provider === 'neon' ? '\uD83D\uDFE2 Neon' : dbUrlInfo.provider,
|
|
663
|
+
' detected',
|
|
664
|
+
dbUrlInfo.isPooler || dbUrlInfo.optimizedUrl ? ' \u2014 connection will be auto-optimized' : ' (direct connection)'
|
|
665
|
+
),
|
|
666
|
+
// Auto-fix notifications (green — things we fixed for them)
|
|
667
|
+
dbUrlInfo.autoFixed && dbUrlInfo.autoFixed.map(function(f, i) {
|
|
668
|
+
return h('div', { key: 'f' + i, style: { color: '#10b981', padding: '4px 8px', background: 'rgba(16,185,129,0.08)', borderRadius: 6, marginBottom: 4 } },
|
|
669
|
+
'\u2728 Auto-configured: ', f
|
|
670
|
+
);
|
|
671
|
+
}),
|
|
672
|
+
// Warnings (yellow — things they need to act on)
|
|
673
|
+
dbUrlInfo.warnings.map(function(w, i) {
|
|
674
|
+
return h('div', { key: 'w' + i, style: { color: 'var(--warning, #f59e0b)', padding: '4px 8px', background: 'rgba(245,158,11,0.1)', borderRadius: 6, marginBottom: 4 } },
|
|
675
|
+
'\u26A0\uFE0F ', w
|
|
676
|
+
);
|
|
677
|
+
}),
|
|
678
|
+
// Tips (informational)
|
|
679
|
+
dbUrlInfo.tips.map(function(t, i) {
|
|
680
|
+
return h('div', { key: 't' + i, style: { color: 'var(--text-secondary)', padding: '2px 0' } },
|
|
681
|
+
'\u2714\uFE0F ', t
|
|
682
|
+
);
|
|
683
|
+
}),
|
|
684
|
+
// Summary of what will be sent
|
|
685
|
+
(dbUrlInfo.directUrl || dbUrlInfo.optimizedUrl) && h('div', { style: { color: 'var(--text-secondary)', padding: '6px 8px', background: 'var(--bg-secondary)', borderRadius: 6, marginTop: 4, fontSize: 11 } },
|
|
686
|
+
dbUrlInfo.optimizedUrl && h('div', null, '\uD83D\uDD17 Pooler URL: ', h('code', { style: { fontSize: 10 } }, dbUrlInfo.optimizedUrl.substring(0, 60) + '...')),
|
|
687
|
+
dbUrlInfo.directUrl && h('div', null, '\uD83D\uDD17 Direct URL (migrations): ', h('code', { style: { fontSize: 10 } }, dbUrlInfo.directUrl.substring(0, 60) + '...'))
|
|
688
|
+
)
|
|
689
|
+
)
|
|
534
690
|
);
|
|
535
691
|
};
|
|
536
692
|
|
|
@@ -231,6 +231,7 @@ var ACTIVITY_TYPE_COLORS = {
|
|
|
231
231
|
created: '#6366f1', assigned: '#991b1b', started: '#06b6d4', in_progress: '#06b6d4',
|
|
232
232
|
completed: '#15803d', failed: '#ef4444', cancelled: '#6b7394', delegated: '#a855f7',
|
|
233
233
|
compaction: '#8b5cf6', error: '#ef4444',
|
|
234
|
+
crash: '#dc2626', recovery: '#f59e0b', note: '#3b82f6',
|
|
234
235
|
};
|
|
235
236
|
|
|
236
237
|
function ActivityLog(props) {
|
|
@@ -1084,7 +1085,6 @@ export function AgentTaskPipeline(props) {
|
|
|
1084
1085
|
}
|
|
1085
1086
|
|
|
1086
1087
|
return h(Fragment, null,
|
|
1087
|
-
h(orgCtx.Switcher),
|
|
1088
1088
|
active.length > 0 && h('div', { style: { marginBottom: 12 } },
|
|
1089
1089
|
h('div', { style: { fontSize: 11, fontWeight: 600, color: STATUS_COLORS.in_progress, marginBottom: 6, display: 'flex', alignItems: 'center', gap: 4 } },
|
|
1090
1090
|
h('div', { style: { width: 6, height: 6, borderRadius: '50%', background: STATUS_COLORS.in_progress, animation: 'flowPulse 2s infinite' } }),
|