@agenticmail/enterprise 0.5.205 → 0.5.206

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,45 @@
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-3FAXFUMK.js";
18
+ import {
19
+ PROVIDER_REGISTRY,
20
+ listAllProviders,
21
+ resolveApiKeyForProvider,
22
+ resolveProvider
23
+ } from "./chunk-UF3ZJMJO.js";
24
+ import "./chunk-KFQGP6VL.js";
25
+ export {
26
+ AgentRuntime,
27
+ EmailChannel,
28
+ FollowUpScheduler,
29
+ PROVIDER_REGISTRY,
30
+ SessionManager,
31
+ SubAgentManager,
32
+ ToolRegistry,
33
+ callLLM,
34
+ createAgentRuntime,
35
+ createNoopHooks,
36
+ createRuntimeHooks,
37
+ estimateMessageTokens,
38
+ estimateTokens,
39
+ executeTool,
40
+ listAllProviders,
41
+ resolveApiKeyForProvider,
42
+ resolveProvider,
43
+ runAgentLoop,
44
+ toolsToDefinitions
45
+ };
@@ -0,0 +1,15 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-XUF2WJRM.js";
4
+ import "./chunk-OF4MUWWS.js";
5
+ import "./chunk-UF3ZJMJO.js";
6
+ import "./chunk-3OC6RH7W.js";
7
+ import "./chunk-2DDKGTD6.js";
8
+ import "./chunk-YVK6F5OD.js";
9
+ import "./chunk-MKRNEM5A.js";
10
+ import "./chunk-DRXMYYKN.js";
11
+ import "./chunk-6WSX7QXF.js";
12
+ import "./chunk-KFQGP6VL.js";
13
+ export {
14
+ createServer
15
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ promptCompanyInfo,
3
+ promptDatabase,
4
+ promptDeployment,
5
+ promptDomain,
6
+ promptRegistration,
7
+ provision,
8
+ runSetupWizard
9
+ } from "./chunk-NTUFF6XP.js";
10
+ import "./chunk-VQQ4SYYQ.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.205",
3
+ "version": "0.5.206",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -750,7 +750,7 @@ export class ChatPoller {
750
750
  messageText: msg.text,
751
751
  };
752
752
 
753
- const url = `http://${agent.host}:${agent.port}/api/runtime/chat`;
753
+ const url = `http://${agent.host}:${agent.port}/api/engine/runtime/chat`;
754
754
 
755
755
  try {
756
756
  const resp = await fetch(url, {
@@ -437,7 +437,7 @@ export class MessagingPoller {
437
437
  }).catch(() => {});
438
438
  }
439
439
  try {
440
- var resp = await fetch(`http://${agent.host}:${agent.port}/api/runtime/chat`, {
440
+ var resp = await fetch(`http://${agent.host}:${agent.port}/api/engine/runtime/chat`, {
441
441
  method: 'POST',
442
442
  headers: { 'Content-Type': 'application/json' },
443
443
  body: JSON.stringify({
@@ -245,6 +245,51 @@ export function createRuntimeGateway(config: GatewayConfig): Hono {
245
245
 
246
246
  // ─── Inbound Email Hook ──────────────────────────
247
247
 
248
+ // ─── Chat dispatch (from enterprise messaging/chat pollers) ──
249
+ app.post('/chat', async function(c) {
250
+ try {
251
+ var body = await c.req.json();
252
+ // Find or create a session for this chat context
253
+ var source = body.source || body.spaceName || 'unknown';
254
+ var spaceId = body.spaceId || body.chatId || 'default';
255
+ var sessionTag = source + ':' + spaceId;
256
+
257
+ // Look for existing session with this tag
258
+ var sessions = await runtime.listSessions();
259
+ var existing = sessions.find(function(s: any) { return s.tag === sessionTag && s.status === 'active'; });
260
+ var session: any;
261
+
262
+ if (existing) {
263
+ session = existing;
264
+ } else {
265
+ // Create new session
266
+ session = await runtime.createSession({
267
+ tag: sessionTag,
268
+ metadata: { source: source, spaceId: spaceId, senderName: body.senderName, isDM: body.isDM },
269
+ });
270
+ }
271
+
272
+ // Send message to the session
273
+ await runtime.sendMessage(session.id, body.messageText || body.message || '', {
274
+ senderName: body.senderName,
275
+ senderEmail: body.senderEmail,
276
+ source: source,
277
+ isDM: body.isDM,
278
+ isManager: body.isManager,
279
+ priority: body.priority,
280
+ messageId: body.messageId,
281
+ isCustomer: body.isCustomer,
282
+ customerSystemPrompt: body.customerSystemPrompt,
283
+ restrictTools: body.restrictTools,
284
+ });
285
+
286
+ return c.json({ ok: true, sessionId: session.id });
287
+ } catch (err: any) {
288
+ console.error('[runtime] /chat error:', err.message);
289
+ return c.json({ error: err.message }, 500);
290
+ }
291
+ });
292
+
248
293
  app.post('/hooks/inbound', async function(c) {
249
294
  try {
250
295
  var body = await c.req.json();
package/src/server.ts CHANGED
@@ -240,10 +240,13 @@ export function createServer(config: ServerConfig): ServerInstance {
240
240
  return next();
241
241
  }
242
242
 
243
- // Skip auth for runtime/chat — internal dispatch from enterprise to agent process
243
+ // Skip auth for runtime/chat and runtime/hooks — internal dispatch from enterprise to agent process
244
244
  if (c.req.path.includes('/runtime/chat') && c.req.method === 'POST') {
245
245
  return next();
246
246
  }
247
+ if (c.req.path.includes('/runtime/hooks/') && c.req.method === 'POST') {
248
+ return next();
249
+ }
247
250
 
248
251
  // Check API key first
249
252
  const apiKeyHeader = c.req.header('X-API-Key');