@alfe.ai/gateway 0.0.48 → 0.1.0
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/health.js +89 -10
- package/package.json +6 -4
package/dist/health.js
CHANGED
|
@@ -12,7 +12,9 @@ import crypto from "crypto";
|
|
|
12
12
|
import { parse } from "smol-toml";
|
|
13
13
|
import WebSocket from "ws";
|
|
14
14
|
import { createConnection, createServer } from "node:net";
|
|
15
|
-
import { IntegrationManager, IntegrationManagerAdapter, OpenClawApplier } from "@alfe.ai/integrations";
|
|
15
|
+
import { IntegrationManager, IntegrationManagerAdapter, McpApplier, OpenClawApplier } from "@alfe.ai/integrations";
|
|
16
|
+
import { AgentApiClient } from "@alfe.ai/agent-api-client";
|
|
17
|
+
import { Manager } from "@alfe.ai/mcp-bundler";
|
|
16
18
|
import stream, { Readable } from "stream";
|
|
17
19
|
import util, { format } from "util";
|
|
18
20
|
import http from "http";
|
|
@@ -90,6 +92,8 @@ const ID_PREFIXES = {
|
|
|
90
92
|
identityVerification: "ivf",
|
|
91
93
|
role: "role",
|
|
92
94
|
directGrant: "dgr",
|
|
95
|
+
oauthConnection: "con",
|
|
96
|
+
oauthConnectionRequest: "crq",
|
|
93
97
|
attachment: "att",
|
|
94
98
|
run: "run",
|
|
95
99
|
request: "req",
|
|
@@ -421,6 +425,48 @@ var AuthService = class {
|
|
|
421
425
|
body: JSON.stringify({ seats })
|
|
422
426
|
});
|
|
423
427
|
}
|
|
428
|
+
listOrgMembers() {
|
|
429
|
+
return this.client.request(`${this.prefix}/org/members`);
|
|
430
|
+
}
|
|
431
|
+
patchOrgMember(userId, body) {
|
|
432
|
+
return this.client.request(`${this.prefix}/org/members/${encodeURIComponent(userId)}`, {
|
|
433
|
+
method: "PATCH",
|
|
434
|
+
body: JSON.stringify(body)
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
removeOrgMember(userId) {
|
|
438
|
+
return this.client.request(`${this.prefix}/org/members/${encodeURIComponent(userId)}`, { method: "DELETE" });
|
|
439
|
+
}
|
|
440
|
+
listOrgInvitations() {
|
|
441
|
+
return this.client.request(`${this.prefix}/org/invitations`);
|
|
442
|
+
}
|
|
443
|
+
createOrgInvitation(input) {
|
|
444
|
+
return this.client.request(`${this.prefix}/org/invitations`, {
|
|
445
|
+
method: "POST",
|
|
446
|
+
body: JSON.stringify(input)
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
revokeOrgInvitation(invitationId) {
|
|
450
|
+
return this.client.request(`${this.prefix}/org/invitations/${encodeURIComponent(invitationId)}`, { method: "DELETE" });
|
|
451
|
+
}
|
|
452
|
+
listOrgDomains() {
|
|
453
|
+
return this.client.request(`${this.prefix}/org/domains`);
|
|
454
|
+
}
|
|
455
|
+
createOrgDomain(input) {
|
|
456
|
+
return this.client.request(`${this.prefix}/org/domains`, {
|
|
457
|
+
method: "POST",
|
|
458
|
+
body: JSON.stringify(input)
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
deleteOrgDomain(domainId) {
|
|
462
|
+
return this.client.request(`${this.prefix}/org/domains/${encodeURIComponent(domainId)}`, { method: "DELETE" });
|
|
463
|
+
}
|
|
464
|
+
updateOrgSettings(input) {
|
|
465
|
+
return this.client.request(`${this.prefix}/org/settings`, {
|
|
466
|
+
method: "PATCH",
|
|
467
|
+
body: JSON.stringify(input)
|
|
468
|
+
});
|
|
469
|
+
}
|
|
424
470
|
};
|
|
425
471
|
//#endregion
|
|
426
472
|
//#region ../../packages-internal/api-client/dist/services/integrations.js
|
|
@@ -536,12 +582,6 @@ var IntegrationsService = class {
|
|
|
536
582
|
const query = email ? `?email=${encodeURIComponent(email)}` : "";
|
|
537
583
|
return this.client.request(`/google/agents/${encodeURIComponent(agentId)}/account${query}`, { method: "DELETE" });
|
|
538
584
|
}
|
|
539
|
-
setDefaultGoogleAccount(agentId, email) {
|
|
540
|
-
return this.client.request(`/google/agents/${encodeURIComponent(agentId)}/account/default`, {
|
|
541
|
-
method: "PUT",
|
|
542
|
-
body: JSON.stringify({ email })
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
585
|
getAtlassianSites(agentId) {
|
|
546
586
|
return this.client.request(`/atlassian/agents/${encodeURIComponent(agentId)}/sites`);
|
|
547
587
|
}
|
|
@@ -4452,6 +4492,7 @@ const GoogleModel = {
|
|
|
4452
4492
|
const GOOGLE_MODELS = enumValues(GoogleModel);
|
|
4453
4493
|
const MiniMaxModel = {
|
|
4454
4494
|
M27: "MiniMax-M2.7",
|
|
4495
|
+
M27HighSpeed: "MiniMax-M2.7-highspeed",
|
|
4455
4496
|
M25: "MiniMax-M2.5"
|
|
4456
4497
|
};
|
|
4457
4498
|
const MINIMAX_MODELS = enumValues(MiniMaxModel);
|
|
@@ -4491,8 +4532,8 @@ _enum(MISTRAL_MODELS);
|
|
|
4491
4532
|
_enum(XAI_MODELS);
|
|
4492
4533
|
_enum(ZHIPU_MODELS);
|
|
4493
4534
|
string().min(1);
|
|
4494
|
-
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
4495
|
-
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
4535
|
+
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
4536
|
+
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M27HighSpeed, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
4496
4537
|
enumValues({
|
|
4497
4538
|
PendingChallenge: "pending_challenge",
|
|
4498
4539
|
Creating: "creating",
|
|
@@ -4799,7 +4840,7 @@ async function loadDaemonConfig() {
|
|
|
4799
4840
|
orgId: identity.orgId,
|
|
4800
4841
|
runtime: identity.runtime,
|
|
4801
4842
|
runtimes,
|
|
4802
|
-
autoStartRuntime: alfeConfig.auto_start_runtime ??
|
|
4843
|
+
autoStartRuntime: alfeConfig.auto_start_runtime ?? true
|
|
4803
4844
|
};
|
|
4804
4845
|
}
|
|
4805
4846
|
/**
|
|
@@ -21841,6 +21882,30 @@ let stopPairingApprovalPoller = null;
|
|
|
21841
21882
|
* (works when systemd runs the gateway binary directly, since
|
|
21842
21883
|
* the path is .../cli/node_modules/@alfe.ai/gateway/dist/...)
|
|
21843
21884
|
*/
|
|
21885
|
+
/**
|
|
21886
|
+
* Adapter from `AgentApiClient`'s per-provider methods to the
|
|
21887
|
+
* `CredentialsResolver` shape the MCP applier expects. Returns
|
|
21888
|
+
* `undefined` for unknown providers and on 404/network error so the
|
|
21889
|
+
* applier can skip registration silently (its documented contract).
|
|
21890
|
+
*/
|
|
21891
|
+
async function fetchProviderCredentials(agentApi, provider) {
|
|
21892
|
+
const key = provider.toLowerCase();
|
|
21893
|
+
try {
|
|
21894
|
+
switch (key) {
|
|
21895
|
+
case "atlassian": return await agentApi.getAtlassianCredentials();
|
|
21896
|
+
case "github": return await agentApi.getGithubCredentials();
|
|
21897
|
+
case "xero": return await agentApi.getXeroCredentials();
|
|
21898
|
+
case "notion": return await agentApi.getNotionCredentials();
|
|
21899
|
+
case "myob": return await agentApi.getMYOBCredentials();
|
|
21900
|
+
case "google": return await agentApi.getGoogleCredentials();
|
|
21901
|
+
default:
|
|
21902
|
+
logger$1.warn({ provider }, "Unknown OAuth provider for requires_credentials — MCP server will be skipped");
|
|
21903
|
+
return;
|
|
21904
|
+
}
|
|
21905
|
+
} catch {
|
|
21906
|
+
return;
|
|
21907
|
+
}
|
|
21908
|
+
}
|
|
21844
21909
|
async function getCliVersion() {
|
|
21845
21910
|
if (process.env.ALFE_CLI_VERSION) return process.env.ALFE_CLI_VERSION;
|
|
21846
21911
|
try {
|
|
@@ -22056,8 +22121,18 @@ async function startDaemon() {
|
|
|
22056
22121
|
apiBaseUrl: config.apiEndpoint,
|
|
22057
22122
|
getToken: () => Promise.resolve(config.apiKey)
|
|
22058
22123
|
}));
|
|
22124
|
+
const agentApi = new AgentApiClient({
|
|
22125
|
+
apiKey: config.apiKey,
|
|
22126
|
+
apiUrl: config.apiEndpoint
|
|
22127
|
+
});
|
|
22128
|
+
const mcpManager = new Manager({ logger: logger$1 });
|
|
22059
22129
|
integrationManager = new IntegrationManager({
|
|
22060
22130
|
runtimeAppliers,
|
|
22131
|
+
mcpApplier: new McpApplier({
|
|
22132
|
+
manager: mcpManager,
|
|
22133
|
+
credentials: { getCredentials: (provider) => fetchProviderCredentials(agentApi, provider) },
|
|
22134
|
+
platform: { apiUrl: config.apiEndpoint }
|
|
22135
|
+
}),
|
|
22061
22136
|
registryFetcher: async () => {
|
|
22062
22137
|
const result = await integrationsService.getRegistry();
|
|
22063
22138
|
if (!result.ok) throw new Error(result.error);
|
|
@@ -22091,6 +22166,7 @@ async function startDaemon() {
|
|
|
22091
22166
|
});
|
|
22092
22167
|
cloudClient.start();
|
|
22093
22168
|
logger$1.debug("Cloud client started");
|
|
22169
|
+
if (!config.autoStartRuntime && config.runtime) logger$1.warn({ runtime: config.runtime }, "Runtime configured but auto_start_runtime=false — runtime will not be spawned; in-runtime plugins (chat/console/sync) will be offline until you start it manually");
|
|
22094
22170
|
if (config.autoStartRuntime && config.runtime) {
|
|
22095
22171
|
logger$1.debug({ runtime: config.runtime }, "Starting agent runtime...");
|
|
22096
22172
|
const runtimeCfg = config.runtimes[config.runtime];
|
|
@@ -22127,6 +22203,9 @@ async function startDaemon() {
|
|
|
22127
22203
|
await runtimeProcess.stop();
|
|
22128
22204
|
logger$1.debug("Runtime process stopped");
|
|
22129
22205
|
}
|
|
22206
|
+
logger$1.debug("Stopping MCP bundler manager...");
|
|
22207
|
+
await mcpManager.dispose();
|
|
22208
|
+
logger$1.debug("MCP bundler manager stopped");
|
|
22130
22209
|
if (ipcServer) {
|
|
22131
22210
|
logger$1.debug("Stopping IPC server...");
|
|
22132
22211
|
await ipcServer.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/gateway",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Alfe local gateway daemon — persistent control plane for agent integrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
"pino-roll": "^1.2.0",
|
|
23
23
|
"smol-toml": ">=1.6.1",
|
|
24
24
|
"ws": "^8.18.0",
|
|
25
|
-
"@alfe.ai/
|
|
25
|
+
"@alfe.ai/agent-api-client": "^0.1.4",
|
|
26
|
+
"@alfe.ai/ai-proxy-local": "^0.0.9",
|
|
26
27
|
"@alfe.ai/config": "^0.0.8",
|
|
27
|
-
"@alfe.ai/integration-manifest": "^0.0
|
|
28
|
-
"@alfe.ai/integrations": "^0.0
|
|
28
|
+
"@alfe.ai/integration-manifest": "^0.1.0",
|
|
29
|
+
"@alfe.ai/integrations": "^0.1.0",
|
|
30
|
+
"@alfe.ai/mcp-bundler": "^0.1.0"
|
|
29
31
|
},
|
|
30
32
|
"license": "UNLICENSED",
|
|
31
33
|
"scripts": {
|