@alfe.ai/gateway 0.9.12 → 0.9.14

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.
Files changed (2) hide show
  1. package/dist/health.js +55 -6
  2. package/package.json +5 -5
package/dist/health.js CHANGED
@@ -4267,6 +4267,11 @@ enumValues({
4267
4267
  Public: "public",
4268
4268
  Hidden: "hidden"
4269
4269
  });
4270
+ enumValues({
4271
+ Connection: "connection",
4272
+ Channel: "channel",
4273
+ Integration: "integration"
4274
+ });
4270
4275
  enumValues({
4271
4276
  Active: "active",
4272
4277
  Removed: "removed"
@@ -4383,7 +4388,7 @@ enumValues({
4383
4388
  Live: "live"
4384
4389
  });
4385
4390
  function createClerkReverificationResponse(afterMinutes) {
4386
- if (!Number.isInteger(afterMinutes) || afterMinutes < 0) throw new TypeError("afterMinutes must be a non-negative integer");
4391
+ if (!Number.isInteger(afterMinutes) || afterMinutes < 1) throw new TypeError("afterMinutes must be a positive integer");
4387
4392
  return { clerk_error: {
4388
4393
  type: "forbidden",
4389
4394
  reason: "reverification-error",
@@ -4400,7 +4405,7 @@ function isClerkReverificationResponse(value) {
4400
4405
  if (!clerkError || typeof clerkError !== "object") return false;
4401
4406
  const error = clerkError;
4402
4407
  const reverification = error.metadata?.reverification;
4403
- return error.type === "forbidden" && error.reason === "reverification-error" && reverification?.level === "second_factor" && Number.isInteger(reverification.afterMinutes) && reverification.afterMinutes >= 0;
4408
+ return error.type === "forbidden" && error.reason === "reverification-error" && reverification?.level === "second_factor" && Number.isInteger(reverification.afterMinutes) && reverification.afterMinutes >= 1;
4404
4409
  }
4405
4410
  //#endregion
4406
4411
  //#region ../../packages-internal/types/dist/models.js
@@ -4528,6 +4533,7 @@ _enum(MOONSHOT_MODELS);
4528
4533
  _enum(QWEN_MODELS);
4529
4534
  string().trim().min(1);
4530
4535
  AnthropicModel.Opus5, AnthropicModel.Opus48, AnthropicModel.Opus47, AnthropicModel.Opus46, AnthropicModel.Sonnet5, AnthropicModel.Sonnet46, AnthropicModel.Haiku45, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.GPT55Pro, OpenAIModel.GPT56Sol, OpenAIModel.GPT56Terra, OpenAIModel.GPT56Luna, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, OpenAIModel.TextEmbedding3Large, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini35Flash, GoogleModel.Gemini31Pro, GoogleModel.Gemini31FlashLite, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M3, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MiniMaxModel.M21, MiniMaxModel.M2, MistralModel.Large, MistralModel.Medium, MistralModel.Small, MistralModel.Codestral, MistralModel.Ministral8b, MistralModel.Ministral3b, MistralModel.MagistralMedium, MistralModel.MagistralSmall, MistralModel.DevstralMedium, XAIModel.Grok45, XAIModel.Grok43, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM52, ZhipuModel.GLM51, ZhipuModel.GLM46, ZhipuModel.GLM45, ZhipuModel.GLM45Air, MoonshotModel.K3, MoonshotModel.K26, MoonshotModel.K27Code, MoonshotModel.K27CodeHighSpeed, QwenModel.Qwen37Max, QwenModel.Qwen37Plus, QwenModel.Qwen36Flash, QwenModel.Qwen35Flash;
4536
+ ({ Qwen3_8B: "alfe-qwen3-8b" }).Qwen3_8B;
4531
4537
  AnthropicModel.Opus5, AnthropicModel.Opus48, AnthropicModel.Opus47, AnthropicModel.Opus46, AnthropicModel.Sonnet5, AnthropicModel.Sonnet46, AnthropicModel.Haiku45, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.GPT55Pro, OpenAIModel.GPT56Sol, OpenAIModel.GPT56Terra, OpenAIModel.GPT56Luna, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, OpenAIModel.TextEmbedding3Large, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini35Flash, GoogleModel.Gemini31Pro, GoogleModel.Gemini31FlashLite, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M3, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MiniMaxModel.M21, MiniMaxModel.M2, MistralModel.Large, MistralModel.Medium, MistralModel.Small, MistralModel.Codestral, MistralModel.Ministral8b, MistralModel.Ministral3b, MistralModel.MagistralMedium, MistralModel.MagistralSmall, MistralModel.DevstralMedium, XAIModel.Grok45, XAIModel.Grok43, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM52, ZhipuModel.GLM51, ZhipuModel.GLM46, ZhipuModel.GLM45, ZhipuModel.GLM45Air, MoonshotModel.K3, MoonshotModel.K26, MoonshotModel.K27Code, MoonshotModel.K27CodeHighSpeed, QwenModel.Qwen37Max, QwenModel.Qwen37Plus, QwenModel.Qwen36Flash, QwenModel.Qwen35Flash;
4532
4538
  enumValues({
4533
4539
  Standard: "standard",
@@ -4646,6 +4652,7 @@ const NotificationType = {
4646
4652
  BrowserTakeoverRequested: "browser_takeover_requested",
4647
4653
  InviteCreated: "onboarding.invite.created",
4648
4654
  OrgClaimed: "onboarding.org.claimed",
4655
+ PartnerApplicationInvitation: "partner.application.invitation",
4649
4656
  ElevatedSupportRequested: "partner.elevated_support.requested",
4650
4657
  ElevatedSupportStarted: "partner.elevated_support.started",
4651
4658
  TeamMemberAdded: "team.member.added",
@@ -4662,7 +4669,7 @@ const RecipientStrategy = {
4662
4669
  TenantAdmins: "tenant_admins",
4663
4670
  SpecificUser: "specific_user"
4664
4671
  };
4665
- NotificationType.PaymentSucceeded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.PaymentFailed, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.TopUpCompleted, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AutoRechargeCompleted, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.AutoRechargeFailed, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.SubscriptionCreated, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.SubscriptionCancelled, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.StartupGrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.GrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.EnterpriseGrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.SubscriptionPastDue, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.BalanceThresholdWarning, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.PlatformTierPriceIncrease, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.AgentCreated, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentProvisionFailed, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentBillingSuspended, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentDisconnectedExtended, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Push, NotificationType.BrowserTakeoverRequested, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.InviteCreated, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.OrgClaimed, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.ElevatedSupportRequested, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.ElevatedSupportStarted, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.TeamMemberAdded, NotificationCategory.Team, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationChannel.Push, NotificationType.ProjectMemberAdded, NotificationCategory.Team, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationChannel.Push, NotificationType.IntegrationInstalled, NotificationCategory.Integrations, RecipientStrategy.TenantAdmins, NotificationChannel.Push, NotificationType.IntegrationRemoved, NotificationCategory.Integrations, RecipientStrategy.TenantAdmins, NotificationChannel.Push;
4672
+ NotificationType.PaymentSucceeded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.PaymentFailed, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.TopUpCompleted, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AutoRechargeCompleted, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.AutoRechargeFailed, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.SubscriptionCreated, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.SubscriptionCancelled, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.StartupGrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.GrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.EnterpriseGrantEnded, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.SubscriptionPastDue, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationChannel.Sms, NotificationType.BalanceThresholdWarning, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.PlatformTierPriceIncrease, NotificationCategory.Billing, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.AgentCreated, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentProvisionFailed, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentBillingSuspended, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.AgentDisconnectedExtended, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Push, NotificationType.BrowserTakeoverRequested, NotificationCategory.Agents, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.InviteCreated, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationType.OrgClaimed, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.PartnerApplicationInvitation, NotificationCategory.System, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationType.ElevatedSupportRequested, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.ElevatedSupportStarted, NotificationCategory.System, RecipientStrategy.TenantAdmins, NotificationChannel.Email, NotificationChannel.Push, NotificationType.TeamMemberAdded, NotificationCategory.Team, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationChannel.Push, NotificationType.ProjectMemberAdded, NotificationCategory.Team, RecipientStrategy.SpecificUser, NotificationChannel.Email, NotificationChannel.Push, NotificationType.IntegrationInstalled, NotificationCategory.Integrations, RecipientStrategy.TenantAdmins, NotificationChannel.Push, NotificationType.IntegrationRemoved, NotificationCategory.Integrations, RecipientStrategy.TenantAdmins, NotificationChannel.Push;
4666
4673
  //#endregion
4667
4674
  //#region ../../packages-internal/api-client/dist/client.js
4668
4675
  /**
@@ -5233,6 +5240,15 @@ var IntegrationsService = class {
5233
5240
  const query = new URLSearchParams({ agentId });
5234
5241
  return this.client.request(`/discord/guilds/${encodeURIComponent(guildId)}/channels?${query}`);
5235
5242
  }
5243
+ getDiscordAppSetup(agentId) {
5244
+ return this.client.request(`/discord/agents/${encodeURIComponent(agentId)}/app`);
5245
+ }
5246
+ configureDiscordApp(agentId, input) {
5247
+ return this.client.request(`/discord/agents/${encodeURIComponent(agentId)}/app`, {
5248
+ method: "PUT",
5249
+ body: JSON.stringify(input)
5250
+ });
5251
+ }
5236
5252
  searchMobileNumbers(country, query) {
5237
5253
  const params = new URLSearchParams();
5238
5254
  if (country !== void 0) params.set("country", country);
@@ -5382,6 +5398,24 @@ function deriveGatewayWsUrl(apiEndpoint) {
5382
5398
  return "wss://gateway.alfe.ai/ws";
5383
5399
  }
5384
5400
  }
5401
+ function validatePrivateManagedWsUrl(value, service) {
5402
+ let url;
5403
+ try {
5404
+ url = new URL(value);
5405
+ } catch {
5406
+ throw new Error(`${service} WebSocket URL must be a valid regional service URL`);
5407
+ }
5408
+ if (url.protocol !== "ws:" || !url.hostname.endsWith(".local") && !url.hostname.endsWith(".sst") || url.pathname !== "/ws" || url.username !== "" || url.password !== "" || url.search !== "" || url.hash !== "") throw new Error(`${service} WebSocket URL must be a canonical VPC-local regional service URL`);
5409
+ return url.toString();
5410
+ }
5411
+ function _resolveManagedGatewayWsUrl(apiEndpoint) {
5412
+ const override = process.env.ALFE_GATEWAY_WS_URL?.trim();
5413
+ if (process.env.ALFE_PRIVATE_DATA_PLANE === "true") {
5414
+ if (!override) throw new Error("ALFE_GATEWAY_WS_URL is required in AWS-private managed mode");
5415
+ return validatePrivateManagedWsUrl(override, "Gateway");
5416
+ }
5417
+ return override && override.length > 0 ? override : deriveGatewayWsUrl(apiEndpoint);
5418
+ }
5385
5419
  /**
5386
5420
  * Parse [runtimes.*] sections from config.toml.
5387
5421
  * Returns a map of runtime name → RuntimeConfig.
@@ -5456,7 +5490,7 @@ async function loadManagedConfig() {
5456
5490
  const apiEndpoint = process.env.ALFE_API_ENDPOINT ?? getEndpointFromToken(apiKey);
5457
5491
  logger$1.debug({ apiEndpoint }, "Environment loaded, resolving identity...");
5458
5492
  const identity = await resolveAgentIdentity(apiKey, apiEndpoint);
5459
- const gatewayWsUrl = deriveGatewayWsUrl(apiEndpoint);
5493
+ const gatewayWsUrl = _resolveManagedGatewayWsUrl(apiEndpoint);
5460
5494
  logger$1.debug({
5461
5495
  agentId: identity.agentId,
5462
5496
  orgId: identity.orgId,
@@ -6935,6 +6969,15 @@ const SYSTEMD_SERVICE = "alfe-gateway";
6935
6969
  const MANAGED_ENV_VARS = [
6936
6970
  "ALFE_MANAGED",
6937
6971
  "ALFE_API_KEY",
6972
+ "ALFE_API_ENDPOINT",
6973
+ "ALFE_API_URL",
6974
+ "ALFE_AI_PROXY_URL",
6975
+ "ALFE_CHAT_WS_URL",
6976
+ "ALFE_GATEWAY_WS_URL",
6977
+ "ALFE_SYNC_RELAY_WS_URL",
6978
+ "ALFE_PRIVATE_DATA_PLANE",
6979
+ "ALFE_PRIVATE_DATA_PLANE_REGION",
6980
+ "ALFE_PRIVATE_DATA_PLANE_RELEASE",
6938
6981
  "LOG_LEVEL",
6939
6982
  "ALFE_CLI_VERSION"
6940
6983
  ];
@@ -7977,12 +8020,18 @@ async function startAiProxy(apiKey) {
7977
8020
  try {
7978
8021
  const { createProxyServer, DEFAULT_AI_PROXY_PORT } = await import("@alfe.ai/ai-proxy-local");
7979
8022
  const { getAiServiceUrlFromToken } = await import("@alfe.ai/config");
7980
- const proxyUrl = getAiServiceUrlFromToken(apiKey);
8023
+ const privateDataPlane = process.env.ALFE_PRIVATE_DATA_PLANE === "true";
8024
+ const proxyUrlOverride = process.env.ALFE_AI_PROXY_URL?.trim();
8025
+ const configuredProxyUrl = proxyUrlOverride && proxyUrlOverride.length > 0 ? proxyUrlOverride : void 0;
8026
+ if (privateDataPlane && configuredProxyUrl === void 0) throw new Error("AWS-private AI proxy target is not configured");
8027
+ const proxyUrl = configuredProxyUrl ?? getAiServiceUrlFromToken(apiKey);
7981
8028
  const port = DEFAULT_AI_PROXY_PORT ?? 18193;
7982
8029
  handle.server = createProxyServer({
7983
8030
  port,
7984
8031
  apiKey,
7985
- proxyUrl
8032
+ proxyUrl,
8033
+ allowPrivateAwsTarget: privateDataPlane,
8034
+ requirePrivateAwsTarget: privateDataPlane
7986
8035
  });
7987
8036
  const server = handle.server;
7988
8037
  await new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/gateway",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
4
4
  "description": "Alfe local gateway daemon — persistent control plane for agent integrations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,11 +23,11 @@
23
23
  "pino-roll": "^1.2.0",
24
24
  "smol-toml": ">=1.6.1",
25
25
  "ws": "^8.18.0",
26
- "@alfe.ai/agent-api-client": "^0.17.0",
27
- "@alfe.ai/ai-proxy-local": "^0.0.16",
26
+ "@alfe.ai/agent-api-client": "^0.17.1",
27
+ "@alfe.ai/ai-proxy-local": "^0.0.17",
28
28
  "@alfe.ai/config": "^0.4.1",
29
- "@alfe.ai/integration-manifest": "^0.3.6",
30
- "@alfe.ai/integrations": "^0.6.3",
29
+ "@alfe.ai/integration-manifest": "^0.4.0",
30
+ "@alfe.ai/integrations": "^0.6.4",
31
31
  "@alfe.ai/mcp-bundler": "^0.4.1"
32
32
  },
33
33
  "license": "UNLICENSED",