@agenticmail/enterprise 0.5.33 → 0.5.35
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-3NSKE5DQ.js +898 -0
- package/dist/chunk-BXUATBCN.js +12666 -0
- package/dist/chunk-IKAR55YS.js +12676 -0
- package/dist/chunk-LLRHGL2Z.js +2115 -0
- package/dist/chunk-OBDRC4BM.js +2297 -0
- package/dist/chunk-R6YVL6Y6.js +898 -0
- package/dist/chunk-U4L5EDIG.js +2115 -0
- package/dist/chunk-ULKC7YCU.js +9083 -0
- package/dist/chunk-V56UE7DJ.js +9083 -0
- package/dist/chunk-WEWW2XJW.js +48 -0
- package/dist/cli-recover-OV7SFBBU.js +97 -0
- package/dist/cli-verify-VJJPLLM6.js +98 -0
- package/dist/cli.js +3 -3
- package/dist/db-adapter-EGVL4UHS.js +7 -0
- package/dist/factory-WQW7VSJP.js +9 -0
- package/dist/index.js +6 -6
- package/dist/postgres-7TNODWC5.js +597 -0
- package/dist/routes-LFPOSIXP.js +5772 -0
- package/dist/routes-W5YSU4T5.js +5772 -0
- package/dist/runtime-4C7WHHKA.js +47 -0
- package/dist/runtime-TR2AKTLN.js +47 -0
- package/dist/server-BR3JL7XE.js +12 -0
- package/dist/server-RIF222HK.js +12 -0
- package/dist/setup-EFFRV7HM.js +20 -0
- package/dist/setup-MFRJ6JGJ.js +20 -0
- package/package.json +1 -1
- package/src/db/postgres.ts +2 -2
- package/src/engine/db-adapter.ts +4 -2
- package/src/engine/guardrails.ts +1 -1
- package/src/engine/journal.ts +2 -2
- package/src/engine/org-policies.ts +2 -2
- package/src/engine/policy-import.ts +3 -3
- package/src/engine/storage-manager.ts +2 -2
- package/src/runtime/session-manager.ts +7 -5
|
@@ -0,0 +1,47 @@
|
|
|
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-IKAR55YS.js";
|
|
18
|
+
import "./chunk-TYW5XTOW.js";
|
|
19
|
+
import "./chunk-JLSQOQ5L.js";
|
|
20
|
+
import {
|
|
21
|
+
PROVIDER_REGISTRY,
|
|
22
|
+
listAllProviders,
|
|
23
|
+
resolveApiKeyForProvider,
|
|
24
|
+
resolveProvider
|
|
25
|
+
} from "./chunk-67KZYSLU.js";
|
|
26
|
+
import "./chunk-KFQGP6VL.js";
|
|
27
|
+
export {
|
|
28
|
+
AgentRuntime,
|
|
29
|
+
EmailChannel,
|
|
30
|
+
FollowUpScheduler,
|
|
31
|
+
PROVIDER_REGISTRY,
|
|
32
|
+
SessionManager,
|
|
33
|
+
SubAgentManager,
|
|
34
|
+
ToolRegistry,
|
|
35
|
+
callLLM,
|
|
36
|
+
createAgentRuntime,
|
|
37
|
+
createNoopHooks,
|
|
38
|
+
createRuntimeHooks,
|
|
39
|
+
estimateMessageTokens,
|
|
40
|
+
estimateTokens,
|
|
41
|
+
executeTool,
|
|
42
|
+
listAllProviders,
|
|
43
|
+
resolveApiKeyForProvider,
|
|
44
|
+
resolveProvider,
|
|
45
|
+
runAgentLoop,
|
|
46
|
+
toolsToDefinitions
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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-BXUATBCN.js";
|
|
18
|
+
import "./chunk-TYW5XTOW.js";
|
|
19
|
+
import "./chunk-JLSQOQ5L.js";
|
|
20
|
+
import {
|
|
21
|
+
PROVIDER_REGISTRY,
|
|
22
|
+
listAllProviders,
|
|
23
|
+
resolveApiKeyForProvider,
|
|
24
|
+
resolveProvider
|
|
25
|
+
} from "./chunk-67KZYSLU.js";
|
|
26
|
+
import "./chunk-KFQGP6VL.js";
|
|
27
|
+
export {
|
|
28
|
+
AgentRuntime,
|
|
29
|
+
EmailChannel,
|
|
30
|
+
FollowUpScheduler,
|
|
31
|
+
PROVIDER_REGISTRY,
|
|
32
|
+
SessionManager,
|
|
33
|
+
SubAgentManager,
|
|
34
|
+
ToolRegistry,
|
|
35
|
+
callLLM,
|
|
36
|
+
createAgentRuntime,
|
|
37
|
+
createNoopHooks,
|
|
38
|
+
createRuntimeHooks,
|
|
39
|
+
estimateMessageTokens,
|
|
40
|
+
estimateTokens,
|
|
41
|
+
executeTool,
|
|
42
|
+
listAllProviders,
|
|
43
|
+
resolveApiKeyForProvider,
|
|
44
|
+
resolveProvider,
|
|
45
|
+
runAgentLoop,
|
|
46
|
+
toolsToDefinitions
|
|
47
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-U4L5EDIG.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,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-LLRHGL2Z.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-3NSKE5DQ.js";
|
|
10
|
+
import "./chunk-WEWW2XJW.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,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-R6YVL6Y6.js";
|
|
10
|
+
import "./chunk-WEWW2XJW.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/db/postgres.ts
CHANGED
|
@@ -359,7 +359,7 @@ export class PostgresAdapter extends DatabaseAdapter {
|
|
|
359
359
|
return {
|
|
360
360
|
events: rows.map((r: any) => ({
|
|
361
361
|
id: r.id, timestamp: r.timestamp, actor: r.actor, actorType: r.actor_type,
|
|
362
|
-
action: r.action, resource: r.resource, details: JSON.parse(r.details || '{}'), ip: r.ip,
|
|
362
|
+
action: r.action, resource: r.resource, details: typeof r.details === 'string' ? JSON.parse(r.details || '{}') : (r.details || {}), ip: r.ip,
|
|
363
363
|
})),
|
|
364
364
|
total,
|
|
365
365
|
};
|
|
@@ -464,7 +464,7 @@ export class PostgresAdapter extends DatabaseAdapter {
|
|
|
464
464
|
return {
|
|
465
465
|
enabled: !!rows[0].enabled,
|
|
466
466
|
retainDays: rows[0].retain_days,
|
|
467
|
-
excludeTags: JSON.parse(rows[0].exclude_tags || '[]'),
|
|
467
|
+
excludeTags: typeof rows[0].exclude_tags === 'string' ? JSON.parse(rows[0].exclude_tags || '[]') : (rows[0].exclude_tags || []),
|
|
468
468
|
archiveFirst: !!rows[0].archive_first,
|
|
469
469
|
};
|
|
470
470
|
}
|
package/src/engine/db-adapter.ts
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
import type { ManagedAgent, AgentState, StateTransition, AgentUsage, LifecycleEvent } from './lifecycle.js';
|
|
11
11
|
|
|
12
12
|
/** Safe JSON parse — returns fallback on malformed data instead of throwing */
|
|
13
|
-
function sj(val:
|
|
14
|
-
if (
|
|
13
|
+
function sj(val: any, fallback: any = {}): any {
|
|
14
|
+
if (val == null) return fallback;
|
|
15
|
+
if (typeof val === 'object') return val; // Postgres JSON/JSONB returns parsed objects
|
|
16
|
+
if (typeof val !== 'string') return fallback;
|
|
15
17
|
try { return JSON.parse(val); } catch { return fallback; }
|
|
16
18
|
}
|
|
17
19
|
import type { AgentPermissionProfile } from './skills.js';
|
package/src/engine/guardrails.ts
CHANGED
|
@@ -122,7 +122,7 @@ export class GuardrailEngine {
|
|
|
122
122
|
for (const r of rules) {
|
|
123
123
|
this.anomalyRules.set(r.id, {
|
|
124
124
|
id: r.id, orgId: r.org_id, name: r.name, description: r.description,
|
|
125
|
-
ruleType: r.rule_type, config: JSON.parse(r.config),
|
|
125
|
+
ruleType: r.rule_type, config: typeof r.config === "string" ? JSON.parse(r.config) : (r.config || {}),
|
|
126
126
|
action: r.action, enabled: !!r.enabled,
|
|
127
127
|
createdAt: r.created_at, updatedAt: r.updated_at,
|
|
128
128
|
});
|
package/src/engine/journal.ts
CHANGED
|
@@ -91,8 +91,8 @@ export class ActionJournal {
|
|
|
91
91
|
this.entries = rows.map((r: any) => ({
|
|
92
92
|
id: r.id, orgId: r.org_id, agentId: r.agent_id, sessionId: r.session_id,
|
|
93
93
|
toolId: r.tool_id, toolName: r.tool_name, actionType: r.action_type,
|
|
94
|
-
forwardData: JSON.parse(r.forward_data),
|
|
95
|
-
reverseData: r.reverse_data ? JSON.parse(r.reverse_data) : undefined,
|
|
94
|
+
forwardData: typeof r.forward_data === "string" ? JSON.parse(r.forward_data) : (r.forward_data || {}),
|
|
95
|
+
reverseData: r.reverse_data ? (typeof r.reverse_data === "string" ? JSON.parse(r.reverse_data) : r.reverse_data) : undefined,
|
|
96
96
|
reversible: !!r.reversible, reversed: !!r.reversed,
|
|
97
97
|
reversedAt: r.reversed_at, reversedBy: r.reversed_by,
|
|
98
98
|
createdAt: r.created_at,
|
|
@@ -118,8 +118,8 @@ export class OrgPolicyEngine {
|
|
|
118
118
|
priority: r.priority,
|
|
119
119
|
version: r.version,
|
|
120
120
|
enforcement: r.enforcement as PolicyEnforcement,
|
|
121
|
-
appliesTo: JSON.parse(r.applies_to || '["*"]'),
|
|
122
|
-
tags: JSON.parse(r.tags || '[]'),
|
|
121
|
+
appliesTo: typeof r.applies_to === 'string' ? JSON.parse(r.applies_to || '["*"]') : (r.applies_to || ['*']),
|
|
122
|
+
tags: typeof r.tags === 'string' ? JSON.parse(r.tags || '[]') : (r.tags || []),
|
|
123
123
|
enabled: !!r.enabled,
|
|
124
124
|
createdBy: r.created_by,
|
|
125
125
|
createdAt: r.created_at,
|
|
@@ -745,9 +745,9 @@ export class PolicyImporter {
|
|
|
745
745
|
for (const r of rows) {
|
|
746
746
|
this.jobs.set(r.id, {
|
|
747
747
|
id: r.id, orgId: r.org_id, format: r.format, status: r.status,
|
|
748
|
-
progress: JSON.parse(r.progress ||
|
|
749
|
-
errors: JSON.parse(r.errors ||
|
|
750
|
-
policyIds: JSON.parse(r.policy_ids ||
|
|
748
|
+
progress: typeof r.progress === "string" ? JSON.parse(r.progress || "{}") : (r.progress || {}),
|
|
749
|
+
errors: typeof r.errors === "string" ? JSON.parse(r.errors || "[]") : (r.errors || []),
|
|
750
|
+
policyIds: typeof r.policy_ids === "string" ? JSON.parse(r.policy_ids || "[]") : (r.policy_ids || []),
|
|
751
751
|
createdBy: r.created_by, createdAt: r.created_at,
|
|
752
752
|
completedAt: r.completed_at || undefined,
|
|
753
753
|
});
|
|
@@ -64,7 +64,7 @@ export class StorageManager {
|
|
|
64
64
|
id: r.id,
|
|
65
65
|
orgId: r.org_id,
|
|
66
66
|
storageType: r.storage_type,
|
|
67
|
-
config: JSON.parse(r.config || '{}'),
|
|
67
|
+
config: typeof r.config === 'string' ? JSON.parse(r.config || '{}') : (r.config || {}),
|
|
68
68
|
vaultCredentialId: r.vault_credential_id || undefined,
|
|
69
69
|
enabled: !!r.enabled,
|
|
70
70
|
createdBy: r.created_by,
|
|
@@ -233,7 +233,7 @@ export class StorageManager {
|
|
|
233
233
|
return rows.map((r: any) => ({
|
|
234
234
|
id: r.id, orgId: r.org_id, storageKey: r.storage_key, originalName: r.original_name,
|
|
235
235
|
contentType: r.content_type, size: r.size, relatedType: r.related_type,
|
|
236
|
-
relatedId: r.related_id, metadata: JSON.parse(r.metadata ||
|
|
236
|
+
relatedId: r.related_id, metadata: typeof r.metadata === "string" ? JSON.parse(r.metadata || "{}") : (r.metadata || {}),
|
|
237
237
|
createdBy: r.created_by, createdAt: r.created_at,
|
|
238
238
|
}));
|
|
239
239
|
}
|
|
@@ -313,20 +313,22 @@ export class SessionManager {
|
|
|
313
313
|
|
|
314
314
|
return (rows || []).map(function(row: any) {
|
|
315
315
|
var content: any;
|
|
316
|
-
|
|
317
|
-
content = JSON.parse(row.content);
|
|
318
|
-
} catch {
|
|
316
|
+
if (typeof row.content === 'object' && row.content !== null) {
|
|
319
317
|
content = row.content;
|
|
318
|
+
} else {
|
|
319
|
+
try { content = JSON.parse(row.content); } catch { content = row.content; }
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
var toolCalls: any;
|
|
323
323
|
if (row.tool_calls) {
|
|
324
|
-
|
|
324
|
+
toolCalls = typeof row.tool_calls === 'object' ? row.tool_calls : undefined;
|
|
325
|
+
if (!toolCalls) { try { toolCalls = JSON.parse(row.tool_calls); } catch {} }
|
|
325
326
|
}
|
|
326
327
|
|
|
327
328
|
var toolResults: any;
|
|
328
329
|
if (row.tool_results) {
|
|
329
|
-
|
|
330
|
+
toolResults = typeof row.tool_results === 'object' ? row.tool_results : undefined;
|
|
331
|
+
if (!toolResults) { try { toolResults = JSON.parse(row.tool_results); } catch {} }
|
|
330
332
|
}
|
|
331
333
|
|
|
332
334
|
return {
|