@alfe.ai/gateway 0.9.16 → 0.9.18

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 +108 -6
  2. package/package.json +5 -5
package/dist/health.js CHANGED
@@ -4533,7 +4533,65 @@ _enum(MOONSHOT_MODELS);
4533
4533
  _enum(QWEN_MODELS);
4534
4534
  string().trim().min(1);
4535
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;
4536
+ /**
4537
+ * Alfe-hosted open-weight models are promoted dynamically only in regions
4538
+ * whose private data plane exists. Keep them out of ALL_MODELS so the standard
4539
+ * external-provider seed cannot accidentally register one without its exact
4540
+ * SageMaker route, while still sharing one price contract with model and
4541
+ * billing seeding.
4542
+ */
4543
+ const AlfeAwsModel = { Qwen3_8B: "alfe-qwen3-8b" };
4544
+ /** Reviewed Sydney Bedrock catalog. These are runtime IDs, never cross-region profiles. */
4545
+ const BedrockModel = {
4546
+ GptOss120B: "openai.gpt-oss-120b-1:0",
4547
+ GptOss20B: "openai.gpt-oss-20b-1:0",
4548
+ Qwen3Coder30B: "qwen.qwen3-coder-30b-a3b-v1:0",
4549
+ Glm5: "zai.glm-5",
4550
+ KimiK25: "moonshotai.kimi-k2.5",
4551
+ DeepSeekV32: "deepseek.v3.2",
4552
+ TitanEmbedTextV2: "amazon.titan-embed-text-v2:0"
4553
+ };
4554
+ const AWS_PRIVATE_BEDROCK_CHAT_MODELS = [
4555
+ BedrockModel.GptOss120B,
4556
+ BedrockModel.GptOss20B,
4557
+ BedrockModel.Qwen3Coder30B,
4558
+ BedrockModel.Glm5,
4559
+ BedrockModel.KimiK25,
4560
+ BedrockModel.DeepSeekV32
4561
+ ];
4562
+ AWS_PRIVATE_BEDROCK_CHAT_MODELS.map((modelId) => `alfe-bedrock-${modelId}`);
4563
+ const AWS_PRIVATE_MODEL_PRICING = {
4564
+ [AlfeAwsModel.Qwen3_8B]: {
4565
+ input: .2,
4566
+ output: .6
4567
+ },
4568
+ [BedrockModel.GptOss120B]: {
4569
+ input: .1545,
4570
+ output: .618
4571
+ },
4572
+ [BedrockModel.GptOss20B]: {
4573
+ input: .0721,
4574
+ output: .309
4575
+ },
4576
+ [BedrockModel.Qwen3Coder30B]: {
4577
+ input: .1545,
4578
+ output: .618
4579
+ },
4580
+ [BedrockModel.Glm5]: {
4581
+ input: 1.03,
4582
+ output: 3.3
4583
+ },
4584
+ [BedrockModel.KimiK25]: {
4585
+ input: .618,
4586
+ output: 3.09
4587
+ },
4588
+ [BedrockModel.DeepSeekV32]: {
4589
+ input: .6386,
4590
+ output: 1.9055
4591
+ },
4592
+ [BedrockModel.TitanEmbedTextV2]: { input: .026004 }
4593
+ };
4594
+ Object.fromEntries(AWS_PRIVATE_BEDROCK_CHAT_MODELS.map((modelId) => [`alfe-bedrock-${modelId}`, AWS_PRIVATE_MODEL_PRICING[modelId]]));
4537
4595
  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;
4538
4596
  enumValues({
4539
4597
  Standard: "standard",
@@ -4748,7 +4806,8 @@ var AlfeApiClient = class {
4748
4806
  result: {
4749
4807
  ok: false,
4750
4808
  error: errorMessage ?? (typeof body === "string" ? body : `API error: ${String(res.status)}`),
4751
- status: res.status
4809
+ status: res.status,
4810
+ ...typeof errBody?.code === "string" ? { code: errBody.code } : {}
4752
4811
  }
4753
4812
  };
4754
4813
  }
@@ -4890,6 +4949,17 @@ var AuthService = class {
4890
4949
  body: JSON.stringify({ token })
4891
4950
  });
4892
4951
  }
4952
+ listAccountConnectorGrants(params) {
4953
+ const query = new URLSearchParams();
4954
+ if (params?.cursor !== void 0) query.set("cursor", params.cursor);
4955
+ if (params?.limit !== void 0) query.set("limit", String(params.limit));
4956
+ const queryString = query.toString();
4957
+ const suffix = queryString ? `?${queryString}` : "";
4958
+ return this.client.request(`${this.prefix}/account-connectors/grants${suffix}`);
4959
+ }
4960
+ revokeAccountConnectorGrant(grantId) {
4961
+ return this.client.request(`${this.prefix}/account-connectors/grants/${encodeURIComponent(grantId)}`, { method: "DELETE" });
4962
+ }
4893
4963
  listTokens() {
4894
4964
  return this.client.request(`${this.prefix}/tokens`);
4895
4965
  }
@@ -5190,6 +5260,16 @@ var IntegrationsService = class {
5190
5260
  })
5191
5261
  });
5192
5262
  }
5263
+ /**
5264
+ * The EFFECTIVE set (`effective: true`) resolves connection-/channel-/custom-
5265
+ * driven integrations that have no install row and returns the narrower
5266
+ * {@link EffectiveIntegration} shape (NO `config`). Use it for status/overview
5267
+ * surfaces only. Omit `effective` for config-editing surfaces — the default
5268
+ * path returns full {@link IntegrationInstall} rows including `config`.
5269
+ */
5270
+ listAgentOperationalStatus(agentId) {
5271
+ return this.client.request(`${this.agentIntegrationsPath(agentId)}/status`);
5272
+ }
5193
5273
  listIntegrations(agentId, options) {
5194
5274
  const params = new URLSearchParams();
5195
5275
  if (options?.includeInherited !== void 0) params.set("includeInherited", String(options.includeInherited));
@@ -5758,7 +5838,7 @@ function isDesiredConfig(value) {
5758
5838
  }
5759
5839
  function isDesiredIntegration(value) {
5760
5840
  if (!isRecord(value)) return false;
5761
- return isNonEmptyString(value.integrationId) && typeof value.version === "string" && (value.desiredStatus === "active" || value.desiredStatus === "removed") && (value.reinstallRequestedAt === void 0 || typeof value.reinstallRequestedAt === "string") && (value.customSource === void 0 || isDesiredCustomSource(value.customSource));
5841
+ return isNonEmptyString(value.integrationId) && typeof value.version === "string" && (value.desiredStatus === "active" || value.desiredStatus === "removed") && (value.reinstallRequestedAt === void 0 || typeof value.reinstallRequestedAt === "string") && (value.connectionAuthorityVersion === void 0 || typeof value.connectionAuthorityVersion === "string" && /^[a-f0-9]{64}$/.test(value.connectionAuthorityVersion)) && (value.customSource === void 0 || isDesiredCustomSource(value.customSource));
5762
5842
  }
5763
5843
  /**
5764
5844
  * Type guard: is this a cloud COMMAND message?
@@ -5993,8 +6073,29 @@ var ReconciliationEngine = class {
5993
6073
  const localMap = new Map(localIntegrations.map((i) => [i.id, i]));
5994
6074
  const desiredMap = new Map(desiredIntegrations.map((d) => [d.integrationId, d]));
5995
6075
  try {
5996
- for (const desired of desiredIntegrations) if (desired.desiredStatus === "active") await this.reconcileActive(desired, localMap.get(desired.integrationId), report);
5997
- else await this.reconcileRemoved(desired.integrationId, localMap.get(desired.integrationId), report);
6076
+ for (const desired of desiredIntegrations) if (desired.desiredStatus === "active") {
6077
+ const local = localMap.get(desired.integrationId);
6078
+ if (desired.connectionAuthorityVersion !== void 0 && local?.connectionAuthorityPendingVersion !== void 0 && local.status === "error" && (local.version === desired.version || desired.version === "" || local.version === "unknown") && !(desired.reinstallRequestedAt && local.installedAt && desired.reinstallRequestedAt > local.installedAt) && await this.manager.isInstallIntact(desired.integrationId)) report.results.push({
6079
+ integrationId: desired.integrationId,
6080
+ action: "activated",
6081
+ actualStatus: "active"
6082
+ });
6083
+ else await this.reconcileActive(desired, local, report);
6084
+ const result = report.results.find((item) => item.integrationId === desired.integrationId);
6085
+ if (result?.actualStatus === "active" && desired.connectionAuthorityVersion !== void 0 && (local?.connectionAuthorityPendingVersion !== void 0 || desired.connectionAuthorityVersion !== local?.connectionAuthorityVersion)) try {
6086
+ await this.manager.refreshConnections(desired.integrationId, desired.connectionAuthorityVersion, { onBeforeRuntimeMutation: () => this.ensureSuspended() });
6087
+ } catch (err) {
6088
+ captureIntegrationFailure(desired.integrationId, "refresh_connections", err);
6089
+ const error = err instanceof Error ? err.message : String(err);
6090
+ report.errors.push({
6091
+ integrationId: desired.integrationId,
6092
+ error
6093
+ });
6094
+ result.action = "error";
6095
+ result.actualStatus = "error";
6096
+ result.errorMessage = error;
6097
+ }
6098
+ } else await this.reconcileRemoved(desired.integrationId, localMap.get(desired.integrationId), report);
5998
6099
  for (const local of localIntegrations) if (!desiredMap.has(local.id)) await this.reconcileRemoved(local.id, local, report);
5999
6100
  } finally {
6000
6101
  await this.resumeIfSuspended();
@@ -23820,7 +23921,8 @@ var RuntimeProcess = class {
23820
23921
  cwd: this.options.workspace,
23821
23922
  env: {
23822
23923
  ...process.env,
23823
- ...this.options.env
23924
+ ...this.options.env,
23925
+ ...this.options.runtime === "openclaw" ? { OPENCLAW_SESSION_CACHE_TTL_MS: "0" } : {}
23824
23926
  },
23825
23927
  stdio: [
23826
23928
  "ignore",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/gateway",
3
- "version": "0.9.16",
3
+ "version": "0.9.18",
4
4
  "description": "Alfe local gateway daemon — persistent control plane for agent integrations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,12 +23,12 @@
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.18.0",
26
+ "@alfe.ai/agent-api-client": "^0.19.0",
27
27
  "@alfe.ai/ai-proxy-local": "^0.0.17",
28
28
  "@alfe.ai/config": "^0.4.1",
29
- "@alfe.ai/integration-manifest": "^0.4.0",
30
- "@alfe.ai/integrations": "^0.6.4",
31
- "@alfe.ai/mcp-bundler": "^0.4.1"
29
+ "@alfe.ai/integration-manifest": "^0.4.1",
30
+ "@alfe.ai/integrations": "^0.6.5",
31
+ "@alfe.ai/mcp-bundler": "^0.4.2"
32
32
  },
33
33
  "license": "UNLICENSED",
34
34
  "homepage": "https://alfe.ai",