@alfe.ai/gateway 0.1.2 → 0.1.3

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 +28 -7
  2. package/package.json +4 -4
package/dist/health.js CHANGED
@@ -5167,7 +5167,7 @@ var ReconciliationEngine = class {
5167
5167
  try {
5168
5168
  if (!local) {
5169
5169
  log$2.info(`Installing ${id}@${desired.version}`);
5170
- await this.manager.install(id, desired.version, desired.config);
5170
+ await this.manager.install(id, desired.version, desired.config, desired.customSource);
5171
5171
  report.installed.push(id);
5172
5172
  log$2.info(`Activating ${id}`);
5173
5173
  if ((await this.manager.activate(id)).configApplied) report.configApplied = true;
@@ -5181,7 +5181,7 @@ var ReconciliationEngine = class {
5181
5181
  }
5182
5182
  if (local.version !== desired.version && desired.version !== "" && local.version !== "unknown") {
5183
5183
  log$2.info(`Upgrading ${id}: ${local.version} → ${desired.version}`);
5184
- if ((await this.manager.reinstall(id, desired.version, desired.config)).configApplied) report.configApplied = true;
5184
+ if ((await this.manager.reinstall(id, desired.version, desired.config, desired.customSource)).configApplied) report.configApplied = true;
5185
5185
  report.installed.push(id);
5186
5186
  report.activated.push(id);
5187
5187
  report.results.push({
@@ -5195,7 +5195,7 @@ var ReconciliationEngine = class {
5195
5195
  if (desired.reinstallRequestedAt && local.installedAt && desired.reinstallRequestedAt > local.installedAt) {
5196
5196
  log$2.info(`Reinstalling ${id} from error state (requested: ${desired.reinstallRequestedAt}, installed: ${local.installedAt})`);
5197
5197
  this.manager.resetReinstallAttempts(id);
5198
- if ((await this.manager.reinstall(id, desired.version, desired.config)).configApplied) report.configApplied = true;
5198
+ if ((await this.manager.reinstall(id, desired.version, desired.config, desired.customSource)).configApplied) report.configApplied = true;
5199
5199
  report.installed.push(id);
5200
5200
  report.activated.push(id);
5201
5201
  report.results.push({
@@ -5224,7 +5224,7 @@ var ReconciliationEngine = class {
5224
5224
  log$2.info(`Auto-reinstalling ${id} — install directory is corrupted or missing (attempt ${String(attempts + 1)}/3)`);
5225
5225
  this.manager.incrementReinstallAttempts(id);
5226
5226
  try {
5227
- if ((await this.manager.reinstall(id, desired.version, desired.config)).configApplied) report.configApplied = true;
5227
+ if ((await this.manager.reinstall(id, desired.version, desired.config, desired.customSource)).configApplied) report.configApplied = true;
5228
5228
  this.manager.resetReinstallAttempts(id);
5229
5229
  report.installed.push(id);
5230
5230
  report.activated.push(id);
@@ -5276,7 +5276,7 @@ var ReconciliationEngine = class {
5276
5276
  if (desired.reinstallRequestedAt && local.installedAt && desired.reinstallRequestedAt > local.installedAt) {
5277
5277
  log$2.info(`Reinstall requested for ${id} (requested: ${desired.reinstallRequestedAt}, installed: ${local.installedAt})`);
5278
5278
  this.manager.resetReinstallAttempts(id);
5279
- if ((await this.manager.reinstall(id, desired.version, desired.config)).configApplied) report.configApplied = true;
5279
+ if ((await this.manager.reinstall(id, desired.version, desired.config, desired.customSource)).configApplied) report.configApplied = true;
5280
5280
  report.installed.push(id);
5281
5281
  report.activated.push(id);
5282
5282
  report.results.push({
@@ -22092,7 +22092,28 @@ let stopPairingApprovalPoller = null;
22092
22092
  * `undefined` for unknown providers and on 404/network error so the
22093
22093
  * applier can skip registration silently (its documented contract).
22094
22094
  */
22095
- async function fetchProviderCredentials(agentApi, provider) {
22095
+ async function fetchProviderCredentials(agentApi, provider, connectionId) {
22096
+ if (connectionId) try {
22097
+ const raw = await agentApi.getConnectionCredentials(connectionId);
22098
+ const fields = { ...raw.providerMetadata ?? {} };
22099
+ if (typeof raw.accessToken === "string" && raw.accessToken.length > 0) try {
22100
+ const bundle = JSON.parse(raw.accessToken);
22101
+ if (bundle && typeof bundle === "object" && !Array.isArray(bundle)) Object.assign(fields, bundle);
22102
+ } catch (err) {
22103
+ logger$1.warn({
22104
+ connectionId,
22105
+ err: err instanceof Error ? err.message : String(err)
22106
+ }, "Custom connection accessToken is not a JSON bundle — exposing as accessToken field");
22107
+ fields.accessToken = raw.accessToken;
22108
+ }
22109
+ return fields;
22110
+ } catch (err) {
22111
+ logger$1.warn({
22112
+ connectionId,
22113
+ err: err instanceof Error ? err.message : String(err)
22114
+ }, "Failed to resolve connection-scoped credentials — MCP server will be skipped");
22115
+ return;
22116
+ }
22096
22117
  const key = provider.toLowerCase();
22097
22118
  try {
22098
22119
  switch (key) {
@@ -22360,7 +22381,7 @@ async function startDaemon() {
22360
22381
  runtimeAppliers,
22361
22382
  mcpApplier: new McpApplier({
22362
22383
  manager: mcpManager,
22363
- credentials: { getCredentials: (provider) => fetchProviderCredentials(agentApi, provider) },
22384
+ credentials: { getCredentials: (provider, opts) => fetchProviderCredentials(agentApi, provider, opts?.connectionId) },
22364
22385
  platform: { apiUrl: config.apiEndpoint }
22365
22386
  }),
22366
22387
  registryFetcher: async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/gateway",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Alfe local gateway daemon — persistent control plane for agent integrations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,11 +22,11 @@
22
22
  "pino-roll": "^1.2.0",
23
23
  "smol-toml": ">=1.6.1",
24
24
  "ws": "^8.18.0",
25
- "@alfe.ai/agent-api-client": "^0.2.0",
25
+ "@alfe.ai/agent-api-client": "^0.2.2",
26
26
  "@alfe.ai/ai-proxy-local": "^0.0.10",
27
27
  "@alfe.ai/config": "^0.0.9",
28
- "@alfe.ai/integration-manifest": "^0.2.0",
29
- "@alfe.ai/integrations": "^0.1.2",
28
+ "@alfe.ai/integration-manifest": "^0.2.1",
29
+ "@alfe.ai/integrations": "^0.1.3",
30
30
  "@alfe.ai/mcp-bundler": "^0.2.0"
31
31
  },
32
32
  "license": "UNLICENSED",