@agenticmail/enterprise 0.5.98 → 0.5.99

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,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-3AJ7YYAA.js";
18
+ import "./chunk-NRF3YRF7.js";
19
+ import "./chunk-TYW5XTOW.js";
20
+ import "./chunk-AQH4DFYV.js";
21
+ import "./chunk-JLSQOQ5L.js";
22
+ import {
23
+ PROVIDER_REGISTRY,
24
+ listAllProviders,
25
+ resolveApiKeyForProvider,
26
+ resolveProvider
27
+ } from "./chunk-67KZYSLU.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-KIFKMDHY.js";
4
+ import "./chunk-3SMTCIR4.js";
5
+ import "./chunk-JLSQOQ5L.js";
6
+ import "./chunk-RO537U6H.js";
7
+ import "./chunk-DRXMYYKN.js";
8
+ import "./chunk-67KZYSLU.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-7RUXEES6.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.98",
3
+ "version": "0.5.99",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -309,6 +309,9 @@ export class AgentLifecycleManager {
309
309
  await this.persistAgent(agent);
310
310
 
311
311
  try {
312
+ // Resolve org-level deploy credentials if agent doesn't have its own
313
+ await this.resolveDeployCredentials(agent);
314
+
312
315
  // Run deployment
313
316
  this.transition(agent, 'deploying', 'Pushing configuration', 'system');
314
317
 
@@ -916,6 +919,45 @@ export class AgentLifecycleManager {
916
919
  });
917
920
  }
918
921
 
922
+ /**
923
+ * Resolve org-level deploy credentials and merge into agent config.
924
+ * If the agent's deployment config is missing an API token, look up
925
+ * the org's deploy_credentials table for a matching target type.
926
+ */
927
+ private async resolveDeployCredentials(agent: ManagedAgent): Promise<void> {
928
+ const target = agent.config?.deployment?.target;
929
+ if (!target) return;
930
+
931
+ // Ensure deployment.config exists
932
+ if (!agent.config.deployment.config) agent.config.deployment.config = {} as any;
933
+
934
+ // For fly/railway, check if cloud.apiToken is already set
935
+ if (target === 'fly' || target === 'railway') {
936
+ const cloud = agent.config.deployment.config.cloud;
937
+ if (cloud?.apiToken) return; // Agent has its own token
938
+
939
+ // Look up org-level credentials
940
+ if (this.engineDb) {
941
+ try {
942
+ const orgId = agent.orgId || 'default';
943
+ const creds = await this.engineDb.getDeployCredentialsByType(orgId, target);
944
+ if (creds.length > 0) {
945
+ const orgCred = creds[0];
946
+ agent.config.deployment.config.cloud = {
947
+ ...agent.config.deployment.config.cloud,
948
+ provider: target,
949
+ apiToken: orgCred.config?.apiToken || orgCred.config?.token,
950
+ ...(orgCred.config?.region && { region: orgCred.config.region }),
951
+ ...(orgCred.config?.org && { org: orgCred.config.org }),
952
+ };
953
+ }
954
+ } catch (err) {
955
+ console.error('[lifecycle] Failed to resolve deploy credentials:', err);
956
+ }
957
+ }
958
+ }
959
+ }
960
+
919
961
  private isConfigComplete(config: AgentConfig): boolean {
920
962
  return !!(
921
963
  config.name &&