@agenticmail/enterprise 0.5.32 → 0.5.34
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-BXUATBCN.js +12666 -0
- package/dist/chunk-DR2F2RWV.js +12666 -0
- package/dist/chunk-HN7G4HGB.js +2115 -0
- package/dist/chunk-LLRHGL2Z.js +2115 -0
- package/dist/chunk-OBDRC4BM.js +2297 -0
- package/dist/chunk-PEGTWAPQ.js +898 -0
- package/dist/chunk-R6YVL6Y6.js +898 -0
- package/dist/chunk-ULKC7YCU.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-BM5IMIG2.js +5772 -0
- package/dist/routes-W5YSU4T5.js +5772 -0
- package/dist/runtime-J4MZ7O4W.js +47 -0
- package/dist/runtime-TR2AKTLN.js +47 -0
- package/dist/server-2Z6TXCDZ.js +12 -0
- package/dist/server-RIF222HK.js +12 -0
- package/dist/setup-MFRJ6JGJ.js +20 -0
- package/dist/setup-TD7NDNIX.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/oauth-connect-routes.ts +35 -8
- package/src/engine/org-policies.ts +2 -2
- package/src/engine/policy-import.ts +3 -3
- package/src/engine/storage-manager.ts +1 -1
|
@@ -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-DR2F2RWV.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-HN7G4HGB.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-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
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-PEGTWAPQ.js";
|
|
10
|
+
import "./chunk-ZMZCLNTY.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,
|
|
@@ -82,14 +82,13 @@ export function createOAuthConnectRoutes(vault: SecureVault) {
|
|
|
82
82
|
|
|
83
83
|
// Resolve provider
|
|
84
84
|
const providerKey = SKILL_PROVIDER_MAP[skillId];
|
|
85
|
-
if (providerKey === undefined) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
);
|
|
85
|
+
if (providerKey === undefined || providerKey === null) {
|
|
86
|
+
// Skill doesn't use OAuth — instruct client to use token-based auth (POST /authorize/:skillId)
|
|
87
|
+
return c.json({
|
|
88
|
+
error: `Skill "${skillId}" uses API key authentication, not OAuth. Use the token input to save your API key.`,
|
|
89
|
+
authType: 'token',
|
|
90
|
+
skillId,
|
|
91
|
+
}, 200);
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
const provider: OAuthProviderDefinition | undefined =
|
|
@@ -149,6 +148,34 @@ export function createOAuthConnectRoutes(vault: SecureVault) {
|
|
|
149
148
|
}
|
|
150
149
|
});
|
|
151
150
|
|
|
151
|
+
// ─── POST /authorize/:skillId — Save API key/token directly ─────
|
|
152
|
+
|
|
153
|
+
router.post('/authorize/:skillId', async (c) => {
|
|
154
|
+
try {
|
|
155
|
+
const skillId = c.req.param('skillId');
|
|
156
|
+
const orgId = c.req.query('orgId') || 'default';
|
|
157
|
+
const { token } = await c.req.json();
|
|
158
|
+
|
|
159
|
+
if (!token || typeof token !== 'string' || !token.trim()) {
|
|
160
|
+
return c.json({ error: 'A non-empty token value is required' }, 400);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Store as access_token in vault (same format as OAuth tokens)
|
|
164
|
+
await vault.storeSecret(
|
|
165
|
+
orgId,
|
|
166
|
+
`skill:${skillId}:access_token`,
|
|
167
|
+
'skill_credential',
|
|
168
|
+
token.trim(),
|
|
169
|
+
{ provider: 'api_key', manualEntry: true },
|
|
170
|
+
'dashboard',
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
return c.json({ success: true, skillId, connected: true });
|
|
174
|
+
} catch (e: any) {
|
|
175
|
+
return c.json({ error: e.message }, 500);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
152
179
|
// ─── GET /callback — Handle OAuth redirect ───────────
|
|
153
180
|
|
|
154
181
|
router.get('/callback', async (c) => {
|
|
@@ -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
|
});
|
|
@@ -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
|
}
|