@agenticmail/enterprise 0.5.312 → 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-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-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-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 +8 -2
- 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-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-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/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 +1 -1
- package/src/cli-agent.ts +47 -6
- package/src/cli-serve.ts +2 -5
- package/src/dashboard/app.js +8 -2
- 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 +13 -1
- package/src/system-prompts/triage.ts +1 -1
|
@@ -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' } }),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildCalendarEventPrompt,
|
|
3
|
+
buildContactsPrompt,
|
|
4
|
+
buildDocsTaskPrompt,
|
|
5
|
+
buildDriveTaskPrompt,
|
|
6
|
+
buildFormsPrompt,
|
|
7
|
+
buildGmailPrompt,
|
|
8
|
+
buildGoogleChatPrompt,
|
|
9
|
+
buildGoogleTasksPrompt,
|
|
10
|
+
buildMeetJoinFromChatPrompt,
|
|
11
|
+
buildMeetJoinPrompt,
|
|
12
|
+
buildScheduleBlock,
|
|
13
|
+
buildScheduleInfo,
|
|
14
|
+
buildSheetsTaskPrompt,
|
|
15
|
+
buildSlidesPrompt
|
|
16
|
+
} from "./chunk-7UCKD25B.js";
|
|
17
|
+
import "./chunk-KFQGP6VL.js";
|
|
18
|
+
export {
|
|
19
|
+
buildCalendarEventPrompt,
|
|
20
|
+
buildContactsPrompt,
|
|
21
|
+
buildDocsTaskPrompt,
|
|
22
|
+
buildDriveTaskPrompt,
|
|
23
|
+
buildFormsPrompt,
|
|
24
|
+
buildGmailPrompt,
|
|
25
|
+
buildGoogleChatPrompt,
|
|
26
|
+
buildGoogleTasksPrompt,
|
|
27
|
+
buildMeetJoinFromChatPrompt,
|
|
28
|
+
buildMeetJoinPrompt,
|
|
29
|
+
buildScheduleBlock,
|
|
30
|
+
buildScheduleInfo,
|
|
31
|
+
buildSheetsTaskPrompt,
|
|
32
|
+
buildSlidesPrompt
|
|
33
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
provision,
|
|
9
9
|
runSetupWizard
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XAA4VHHZ.js";
|
|
11
11
|
import {
|
|
12
12
|
AgenticMailManager,
|
|
13
13
|
GoogleEmailProvider,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
executeTool,
|
|
29
29
|
runAgentLoop,
|
|
30
30
|
toolsToDefinitions
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-PFN6DODU.js";
|
|
32
32
|
import {
|
|
33
33
|
ValidationError,
|
|
34
34
|
auditLogger,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
requireRole,
|
|
43
43
|
securityHeaders,
|
|
44
44
|
validate
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-K2DAUYHV.js";
|
|
46
46
|
import "./chunk-DJBCRQTD.js";
|
|
47
47
|
import {
|
|
48
48
|
PROVIDER_REGISTRY,
|
|
@@ -92,14 +92,14 @@ import {
|
|
|
92
92
|
init_storage_manager,
|
|
93
93
|
init_tenant,
|
|
94
94
|
init_workforce
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-DX4XEFVE.js";
|
|
96
96
|
import {
|
|
97
97
|
AgentMemoryManager,
|
|
98
98
|
init_agent_memory
|
|
99
99
|
} from "./chunk-VSBC4SWO.js";
|
|
100
100
|
import "./chunk-AF3WSNVX.js";
|
|
101
101
|
import "./chunk-74ZCQKYU.js";
|
|
102
|
-
import "./chunk-
|
|
102
|
+
import "./chunk-BDCFOP7O.js";
|
|
103
103
|
import "./chunk-C6JP5NR6.js";
|
|
104
104
|
import "./chunk-M6ZIC5H3.js";
|
|
105
105
|
import "./chunk-PWWV2U5P.js";
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
import {
|
|
140
140
|
createAdapter,
|
|
141
141
|
getSupportedDatabases
|
|
142
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-MJGGW6MC.js";
|
|
143
143
|
import {
|
|
144
144
|
AGENTICMAIL_TOOLS,
|
|
145
145
|
ALL_TOOLS,
|