@agenticmail/enterprise 0.5.89 → 0.5.91

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-4VDJQYH6.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-ZFDY6ND5.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-B6FONRAI.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
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ BUILTIN_SKILLS,
3
+ PRESET_PROFILES,
4
+ PermissionEngine,
5
+ SKILL_SUITES
6
+ } from "./chunk-T6FM7KNN.js";
7
+ import "./chunk-MINPSFLF.js";
8
+ import "./chunk-KFQGP6VL.js";
9
+ export {
10
+ BUILTIN_SKILLS,
11
+ PRESET_PROFILES,
12
+ PermissionEngine,
13
+ SKILL_SUITES
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.89",
3
+ "version": "0.5.91",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,4 +50,5 @@ export const I = {
50
50
  eyeOff: () => h('svg', S, h('path', { d: 'M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24' }), h('line', { x1: 1, y1: 1, x2: 23, y2: 23 })),
51
51
  panelLeft: () => h('svg', S, h('rect', { x: 3, y: 3, width: 18, height: 18, rx: 2 }), h('line', { x1: 9, y1: 3, x2: 9, y2: 21 })),
52
52
  chevronLeft: () => h('svg', S, h('polyline', { points: '15 18 9 12 15 6' })),
53
+ edit: () => h('svg', S, h('path', { d: 'M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7' }), h('path', { d: 'M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z' })),
53
54
  };
@@ -295,7 +295,7 @@ export function createAgentRoutes(opts: {
295
295
  if (permissionsData.constraints) profile.constraints = permissionsData.constraints;
296
296
  }
297
297
 
298
- permissions.setProfile(agentId, profile as any);
298
+ permissions.setProfile(agentId, profile as any, orgId);
299
299
  }
300
300
 
301
301
  const _adminDb = getAdminDb();
@@ -7,6 +7,7 @@ import { Hono } from 'hono';
7
7
  import type { PermissionEngine, SkillSuite } from './skills.js';
8
8
  import type { SkillDefinition } from './skills.js';
9
9
  import type { AgentConfigGenerator, AgentConfig } from './agent-config.js';
10
+ import type { AgentLifecycleManager } from './lifecycle.js';
10
11
 
11
12
  interface PresetProfile {
12
13
  name: string;
@@ -28,8 +29,14 @@ export function createCatalogRoutes(opts: {
28
29
  configGen: AgentConfigGenerator;
29
30
  soulLib: SoulLibrary;
30
31
  suites?: SkillSuite[];
32
+ lifecycle?: AgentLifecycleManager;
31
33
  }) {
32
- const { skills, presets, permissions, configGen, soulLib, suites = [] } = opts;
34
+ const { skills, presets, permissions, configGen, soulLib, suites = [], lifecycle } = opts;
35
+
36
+ /** Resolve org ID from Hono context or body. */
37
+ function resolveOrgId(c: any, body: any): string {
38
+ return body?.orgId || c.get?.('orgId') || c.req?.header('x-org-id') || 'default';
39
+ }
33
40
  const router = new Hono();
34
41
 
35
42
  // ─── Skills Catalog ─────────────────────────────────────
@@ -93,20 +100,36 @@ export function createCatalogRoutes(opts: {
93
100
  router.put('/profiles/:agentId', async (c) => {
94
101
  const agentId = c.req.param('agentId');
95
102
  const profile = await c.req.json();
103
+ const orgId = resolveOrgId(c, profile);
96
104
  profile.id = profile.id || agentId;
97
105
  profile.updatedAt = new Date().toISOString();
98
106
  if (!profile.createdAt) profile.createdAt = profile.updatedAt;
99
- permissions.setProfile(agentId, profile);
107
+ permissions.setProfile(agentId, profile, orgId);
108
+ // Also persist permissionProfileId into agent config
109
+ const agent = lifecycle.getAgent(agentId);
110
+ if (agent) {
111
+ agent.config.permissionProfileId = profile.id;
112
+ agent.permissionProfileId = profile.id;
113
+ lifecycle.saveAgent(agentId).catch(() => {});
114
+ }
100
115
  return c.json({ success: true, profile });
101
116
  });
102
117
 
103
118
  router.post('/profiles/:agentId/apply-preset', async (c) => {
104
119
  const agentId = c.req.param('agentId');
105
120
  const { presetName } = await c.req.json();
121
+ const orgId = resolveOrgId(c, {});
106
122
  const preset = presets.find(p => p.name === presetName);
107
123
  if (!preset) return c.json({ error: 'Preset not found' }, 404);
108
124
  const profile = { ...preset, id: agentId, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() };
109
- permissions.setProfile(agentId, profile as any);
125
+ permissions.setProfile(agentId, profile as any, orgId);
126
+ // Also persist permissionProfileId into agent config
127
+ const agent = lifecycle.getAgent(agentId);
128
+ if (agent) {
129
+ agent.config.permissionProfileId = agentId;
130
+ agent.permissionProfileId = agentId;
131
+ lifecycle.saveAgent(agentId).catch(() => {});
132
+ }
110
133
  return c.json({ success: true, profile });
111
134
  });
112
135
 
@@ -327,6 +327,11 @@ export class EngineDatabase {
327
327
  return rows.map(r => sj(r.config));
328
328
  }
329
329
 
330
+ async getAllPermissionProfiles(): Promise<AgentPermissionProfile[]> {
331
+ const rows = await this.db.all<any>('SELECT config FROM permission_profiles ORDER BY name');
332
+ return rows.map(r => sj(r.config));
333
+ }
334
+
330
335
  async deletePermissionProfile(id: string): Promise<void> {
331
336
  await this.db.run('DELETE FROM permission_profiles WHERE id = ?', [id]);
332
337
  }
@@ -181,6 +181,7 @@ engine.route('/', createCatalogRoutes({
181
181
  configGen,
182
182
  soulLib: { getSoulTemplates, getSoulTemplatesByCategory, getSoulTemplate, searchSoulTemplates, SOUL_CATEGORIES },
183
183
  suites: SKILL_SUITES,
184
+ lifecycle,
184
185
  }));
185
186
 
186
187
  engine.route('/', createAgentRoutes({
@@ -344,6 +344,16 @@ export class PermissionEngine {
344
344
  */
345
345
  async setDb(db: import('./db-adapter.js').EngineDatabase): Promise<void> {
346
346
  this.engineDb = db;
347
+ // Load persisted permission profiles from DB
348
+ try {
349
+ const profiles = await db.getAllPermissionProfiles();
350
+ for (const profile of profiles) {
351
+ if (profile && profile.id) {
352
+ this.profiles.set(profile.id, profile);
353
+ }
354
+ }
355
+ if (profiles.length > 0) console.log(`[permissions] Loaded ${profiles.length} permission profiles from DB`);
356
+ } catch { /* table may not exist yet */ }
347
357
  }
348
358
 
349
359
  registerSkill(skill: SkillDefinition) {