@agenticmail/enterprise 0.5.112 → 0.5.114
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/dist/chunk-DV7TLFRE.js +16106 -0
- package/dist/chunk-FUAX3VFP.js +1880 -0
- package/dist/chunk-KYOAISVB.js +898 -0
- package/dist/chunk-O32G2OYT.js +2194 -0
- package/dist/cli-agent-5QA5ZGE6.js +336 -0
- package/dist/cli-agent-GKRF7X2S.js +336 -0
- package/dist/cli-serve-QZA3G4VA.js +34 -0
- package/dist/cli.js +3 -3
- package/dist/index.js +4 -4
- package/dist/lifecycle-IFPWWGQ3.js +10 -0
- package/dist/routes-T4KALX5K.js +6958 -0
- package/dist/runtime-GB7V3PPC.js +49 -0
- package/dist/server-AA5AUIZJ.js +12 -0
- package/dist/setup-JI3PB5CE.js +20 -0
- package/package.json +1 -1
- package/src/cli-agent.ts +47 -11
- package/src/engine/deployer.ts +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-DV7TLFRE.js";
|
|
18
|
+
import "./chunk-TYW5XTOW.js";
|
|
19
|
+
import "./chunk-AQH4DFYV.js";
|
|
20
|
+
import {
|
|
21
|
+
PROVIDER_REGISTRY,
|
|
22
|
+
listAllProviders,
|
|
23
|
+
resolveApiKeyForProvider,
|
|
24
|
+
resolveProvider
|
|
25
|
+
} from "./chunk-67KZYSLU.js";
|
|
26
|
+
import "./chunk-JLSQOQ5L.js";
|
|
27
|
+
import "./chunk-NRF3YRF7.js";
|
|
28
|
+
import "./chunk-KFQGP6VL.js";
|
|
29
|
+
export {
|
|
30
|
+
AgentRuntime,
|
|
31
|
+
EmailChannel,
|
|
32
|
+
FollowUpScheduler,
|
|
33
|
+
PROVIDER_REGISTRY,
|
|
34
|
+
SessionManager,
|
|
35
|
+
SubAgentManager,
|
|
36
|
+
ToolRegistry,
|
|
37
|
+
callLLM,
|
|
38
|
+
createAgentRuntime,
|
|
39
|
+
createNoopHooks,
|
|
40
|
+
createRuntimeHooks,
|
|
41
|
+
estimateMessageTokens,
|
|
42
|
+
estimateTokens,
|
|
43
|
+
executeTool,
|
|
44
|
+
listAllProviders,
|
|
45
|
+
resolveApiKeyForProvider,
|
|
46
|
+
resolveProvider,
|
|
47
|
+
runAgentLoop,
|
|
48
|
+
toolsToDefinitions
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-O32G2OYT.js";
|
|
4
|
+
import "./chunk-3SMTCIR4.js";
|
|
5
|
+
import "./chunk-RO537U6H.js";
|
|
6
|
+
import "./chunk-DRXMYYKN.js";
|
|
7
|
+
import "./chunk-67KZYSLU.js";
|
|
8
|
+
import "./chunk-JLSQOQ5L.js";
|
|
9
|
+
import "./chunk-KFQGP6VL.js";
|
|
10
|
+
export {
|
|
11
|
+
createServer
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-KYOAISVB.js";
|
|
10
|
+
import "./chunk-QDXUZP7Y.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
package/package.json
CHANGED
package/src/cli-agent.ts
CHANGED
|
@@ -280,20 +280,56 @@ export async function runAgent(_args: string[]) {
|
|
|
280
280
|
// Determine provider type from emailConfig
|
|
281
281
|
const providerType = emailConfig.provider || (emailConfig.oauthProvider === 'google' ? 'google' : emailConfig.oauthProvider === 'microsoft' ? 'microsoft' : 'imap');
|
|
282
282
|
const emailProvider = createEmailProvider(providerType);
|
|
283
|
-
|
|
283
|
+
|
|
284
|
+
// Build a token refresh function for OAuth providers
|
|
285
|
+
let currentAccessToken = emailConfig.oauthAccessToken;
|
|
286
|
+
const refreshTokenFn = emailConfig.oauthRefreshToken ? async () => {
|
|
287
|
+
const clientId = emailConfig.oauthClientId;
|
|
288
|
+
const clientSecret = emailConfig.oauthClientSecret;
|
|
289
|
+
const refreshToken = emailConfig.oauthRefreshToken;
|
|
290
|
+
const tokenUrl = providerType === 'google'
|
|
291
|
+
? 'https://oauth2.googleapis.com/token'
|
|
292
|
+
: 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
|
|
293
|
+
const res = await fetch(tokenUrl, {
|
|
294
|
+
method: 'POST',
|
|
295
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
296
|
+
body: new URLSearchParams({
|
|
297
|
+
client_id: clientId,
|
|
298
|
+
client_secret: clientSecret,
|
|
299
|
+
refresh_token: refreshToken,
|
|
300
|
+
grant_type: 'refresh_token',
|
|
301
|
+
}),
|
|
302
|
+
});
|
|
303
|
+
const data = await res.json() as any;
|
|
304
|
+
if (data.access_token) {
|
|
305
|
+
currentAccessToken = data.access_token;
|
|
306
|
+
// Persist updated token back to agent config
|
|
307
|
+
emailConfig.oauthAccessToken = data.access_token;
|
|
308
|
+
if (data.expires_in) emailConfig.oauthTokenExpiry = new Date(Date.now() + data.expires_in * 1000).toISOString();
|
|
309
|
+
lifecycle.saveAgent(AGENT_ID).catch(() => {});
|
|
310
|
+
return data.access_token;
|
|
311
|
+
}
|
|
312
|
+
throw new Error(`Token refresh failed: ${JSON.stringify(data)}`);
|
|
313
|
+
} : undefined;
|
|
314
|
+
|
|
315
|
+
// Refresh token before connecting if it might be expired
|
|
316
|
+
if (refreshTokenFn) {
|
|
317
|
+
try {
|
|
318
|
+
currentAccessToken = await refreshTokenFn();
|
|
319
|
+
console.log('[welcome] Refreshed OAuth token');
|
|
320
|
+
} catch (refreshErr: any) {
|
|
321
|
+
console.error(`[welcome] Token refresh failed: ${refreshErr.message}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
284
325
|
await emailProvider.connect({
|
|
285
326
|
agentId: AGENT_ID,
|
|
327
|
+
name: config.displayName || config.name,
|
|
286
328
|
email: emailConfig.email || config.email?.address || '',
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
oauthTokenExpiry: emailConfig.oauthTokenExpiry,
|
|
292
|
-
imapHost: emailConfig.imapHost,
|
|
293
|
-
imapPort: emailConfig.imapPort,
|
|
294
|
-
smtpHost: emailConfig.smtpHost,
|
|
295
|
-
smtpPort: emailConfig.smtpPort,
|
|
296
|
-
password: emailConfig.password,
|
|
329
|
+
orgId: orgId,
|
|
330
|
+
accessToken: currentAccessToken,
|
|
331
|
+
refreshToken: refreshTokenFn,
|
|
332
|
+
provider: providerType,
|
|
297
333
|
});
|
|
298
334
|
|
|
299
335
|
const agentName = config.displayName || config.name;
|
package/src/engine/deployer.ts
CHANGED
|
@@ -445,7 +445,7 @@ export class DeploymentEngine {
|
|
|
445
445
|
});
|
|
446
446
|
emit('provision', 'completed', `App "${appName}" created`);
|
|
447
447
|
} catch (e: any) {
|
|
448
|
-
if (e.message.includes('already exists')) {
|
|
448
|
+
if (e.message.includes('already exists') || e.message.includes('already been taken')) {
|
|
449
449
|
emit('provision', 'completed', `App "${appName}" already exists, reusing`);
|
|
450
450
|
} else {
|
|
451
451
|
throw e;
|