@agenticmail/enterprise 0.5.101 → 0.5.102

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-5T72N6AX.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-CNJQICZY.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-WIF5R3HF.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.101",
3
+ "version": "0.5.102",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -404,11 +404,14 @@ export class DeploymentEngine {
404
404
  const size = cloud.size || 'shared-cpu-1x';
405
405
  const FLY_API = 'https://api.machines.dev/v1';
406
406
 
407
+ // Fly.io tokens: FlyV1 tokens use their own prefix, others use Bearer
408
+ const authHeader = apiToken.startsWith('FlyV1 ') || apiToken.startsWith('fm2_') ? apiToken.startsWith('FlyV1 ') ? apiToken : `FlyV1 ${apiToken}` : `Bearer ${apiToken}`;
409
+
407
410
  const flyFetch = async (path: string, method: string = 'GET', body?: any): Promise<any> => {
408
411
  const res = await fetch(`${FLY_API}${path}`, {
409
412
  method,
410
413
  headers: {
411
- 'Authorization': `Bearer ${apiToken}`,
414
+ 'Authorization': authHeader,
412
415
  'Content-Type': 'application/json',
413
416
  },
414
417
  body: body ? JSON.stringify(body) : undefined,
@@ -423,8 +426,18 @@ export class DeploymentEngine {
423
426
  // 1. Create app (ignore "already exists" errors)
424
427
  emit('provision', 'started', `Creating Fly.io app "${appName}"...`);
425
428
  try {
426
- // Fly.io org_slug must be a Fly org slug (e.g. 'personal'), not an internal org ID
427
- const flyOrg = (cloud.org && cloud.org.length < 30 && /^[a-z0-9-]+$/.test(cloud.org)) ? cloud.org : 'personal';
429
+ // Fly.io org_slug must be a Fly org slug (e.g. 'personal', 'ope-olatunji'), not an internal org ID
430
+ // If no valid org slug provided, auto-detect from token by listing apps
431
+ let flyOrg = (cloud.org && cloud.org.length < 40 && /^[a-z0-9-]+$/.test(cloud.org)) ? cloud.org : '';
432
+ if (!flyOrg) {
433
+ try {
434
+ const orgsRes = await flyFetch('/apps?org_slug=personal');
435
+ if (orgsRes?.apps?.length > 0 && orgsRes.apps[0].organization?.slug) {
436
+ flyOrg = orgsRes.apps[0].organization.slug;
437
+ }
438
+ } catch {}
439
+ if (!flyOrg) flyOrg = 'personal';
440
+ }
428
441
  await flyFetch('/apps', 'POST', {
429
442
  app_name: appName,
430
443
  org_slug: flyOrg,
@@ -618,10 +631,12 @@ export class DeploymentEngine {
618
631
 
619
632
  const appName = cloud.appName || `am-agent-${config.name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30)}`;
620
633
  const FLY_API = 'https://api.machines.dev/v1';
634
+ const t = cloud.apiToken;
635
+ const auth = t.startsWith('FlyV1 ') ? t : t.startsWith('fm2_') ? `FlyV1 ${t}` : `Bearer ${t}`;
621
636
 
622
637
  try {
623
638
  const res = await fetch(`${FLY_API}/apps/${appName}/machines`, {
624
- headers: { 'Authorization': `Bearer ${cloud.apiToken}` },
639
+ headers: { 'Authorization': auth },
625
640
  });
626
641
  if (!res.ok) return { ...base, status: 'error', healthStatus: 'unhealthy' };
627
642
 
@@ -654,10 +669,12 @@ export class DeploymentEngine {
654
669
 
655
670
  const appName = cloud.appName || `am-agent-${config.name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 30)}`;
656
671
  const FLY_API = 'https://api.machines.dev/v1';
672
+ const t = cloud.apiToken;
673
+ const auth = t.startsWith('FlyV1 ') ? t : t.startsWith('fm2_') ? `FlyV1 ${t}` : `Bearer ${t}`;
657
674
 
658
675
  try {
659
676
  const res = await fetch(`${FLY_API}/apps/${appName}/machines`, {
660
- headers: { 'Authorization': `Bearer ${cloud.apiToken}` },
677
+ headers: { 'Authorization': auth },
661
678
  });
662
679
  if (!res.ok) return { success: false, message: `Failed to list machines: ${res.status}` };
663
680
  const machines = await res.json() as any[];
@@ -666,7 +683,7 @@ export class DeploymentEngine {
666
683
  const machineId = machines[0].id;
667
684
  const actionRes = await fetch(`${FLY_API}/apps/${appName}/machines/${machineId}/${action}`, {
668
685
  method: 'POST',
669
- headers: { 'Authorization': `Bearer ${cloud.apiToken}` },
686
+ headers: { 'Authorization': auth },
670
687
  });
671
688
  if (!actionRes.ok) {
672
689
  const err = await actionRes.text();