@alfe.ai/gateway 0.6.0 → 0.6.1
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 +68 -4
- package/package.json +3 -3
package/dist/health.js
CHANGED
|
@@ -5978,6 +5978,70 @@ var ReconciliationEngine = class {
|
|
|
5978
5978
|
});
|
|
5979
5979
|
return;
|
|
5980
5980
|
}
|
|
5981
|
+
if (local.status === "installing") {
|
|
5982
|
+
if (desired.reinstallRequestedAt && local.installedAt && desired.reinstallRequestedAt > local.installedAt) {
|
|
5983
|
+
await this.ensureSuspended();
|
|
5984
|
+
log$3.info(`Reinstalling ${id} from stale installing state (requested: ${desired.reinstallRequestedAt}, installed: ${local.installedAt})`);
|
|
5985
|
+
this.manager.resetReinstallAttempts(id);
|
|
5986
|
+
this.activateAttempts.delete(id);
|
|
5987
|
+
if ((await this.manager.reinstall(id, desired.version, desired.config, desired.customSource)).configApplied) report.configApplied = true;
|
|
5988
|
+
report.installed.push(id);
|
|
5989
|
+
report.activated.push(id);
|
|
5990
|
+
report.results.push({
|
|
5991
|
+
integrationId: id,
|
|
5992
|
+
action: "installed",
|
|
5993
|
+
actualStatus: "active"
|
|
5994
|
+
});
|
|
5995
|
+
return;
|
|
5996
|
+
}
|
|
5997
|
+
const attempts = this.manager.getReinstallAttempts(id);
|
|
5998
|
+
if (attempts >= 3) {
|
|
5999
|
+
const errorMessage = `Stale installing state — max auto-reinstall attempts (${String(attempts)}) reached — manual reinstall required`;
|
|
6000
|
+
log$3.error(`Auto-reinstall blocked for ${id} — stuck in "installing", ${String(attempts)} consecutive failures. Manual reinstall required.`);
|
|
6001
|
+
captureIntegrationFailure(id, "reinstall", errorMessage);
|
|
6002
|
+
report.errors.push({
|
|
6003
|
+
integrationId: id,
|
|
6004
|
+
error: `Max auto-reinstall attempts (${String(attempts)}) reached`
|
|
6005
|
+
});
|
|
6006
|
+
report.results.push({
|
|
6007
|
+
integrationId: id,
|
|
6008
|
+
action: "error",
|
|
6009
|
+
actualStatus: "error",
|
|
6010
|
+
errorMessage
|
|
6011
|
+
});
|
|
6012
|
+
return;
|
|
6013
|
+
}
|
|
6014
|
+
await this.ensureSuspended();
|
|
6015
|
+
log$3.info(`Recovering ${id} from stale installing state via reinstall (attempt ${String(attempts + 1)}/3)`);
|
|
6016
|
+
this.manager.incrementReinstallAttempts(id);
|
|
6017
|
+
try {
|
|
6018
|
+
if ((await this.manager.reinstall(id, desired.version, desired.config, desired.customSource)).configApplied) report.configApplied = true;
|
|
6019
|
+
this.manager.resetReinstallAttempts(id);
|
|
6020
|
+
this.activateAttempts.delete(id);
|
|
6021
|
+
report.installed.push(id);
|
|
6022
|
+
report.activated.push(id);
|
|
6023
|
+
report.results.push({
|
|
6024
|
+
integrationId: id,
|
|
6025
|
+
action: "installed",
|
|
6026
|
+
actualStatus: "active"
|
|
6027
|
+
});
|
|
6028
|
+
} catch (reinstallErr) {
|
|
6029
|
+
const reinstallMsg = reinstallErr instanceof Error ? reinstallErr.message : String(reinstallErr);
|
|
6030
|
+
log$3.error({ err: reinstallErr }, `Reinstall from stale installing state failed for ${id}`);
|
|
6031
|
+
captureIntegrationFailure(id, "reinstall", reinstallErr);
|
|
6032
|
+
report.errors.push({
|
|
6033
|
+
integrationId: id,
|
|
6034
|
+
error: reinstallMsg
|
|
6035
|
+
});
|
|
6036
|
+
report.results.push({
|
|
6037
|
+
integrationId: id,
|
|
6038
|
+
action: "error",
|
|
6039
|
+
actualStatus: "error",
|
|
6040
|
+
errorMessage: reinstallMsg
|
|
6041
|
+
});
|
|
6042
|
+
}
|
|
6043
|
+
return;
|
|
6044
|
+
}
|
|
5981
6045
|
if (local.status !== "active") {
|
|
5982
6046
|
await this.ensureSuspended();
|
|
5983
6047
|
log$3.info(`Activating ${id}`);
|
|
@@ -24309,10 +24373,6 @@ function handleIntegrationReport(params, pluginId) {
|
|
|
24309
24373
|
*/
|
|
24310
24374
|
async function queryDaemonHealth(socketPath, timeoutMs = 5e3) {
|
|
24311
24375
|
return new Promise((resolve, reject) => {
|
|
24312
|
-
const timer = setTimeout(() => {
|
|
24313
|
-
socket.destroy();
|
|
24314
|
-
reject(/* @__PURE__ */ new Error("Health check timed out"));
|
|
24315
|
-
}, timeoutMs);
|
|
24316
24376
|
let buffer = "";
|
|
24317
24377
|
const requestId = randomUUID();
|
|
24318
24378
|
const socket = createConnection(socketPath, () => {
|
|
@@ -24324,6 +24384,10 @@ async function queryDaemonHealth(socketPath, timeoutMs = 5e3) {
|
|
|
24324
24384
|
}) + "\n";
|
|
24325
24385
|
socket.write(request);
|
|
24326
24386
|
});
|
|
24387
|
+
const timer = setTimeout(() => {
|
|
24388
|
+
socket.destroy();
|
|
24389
|
+
reject(/* @__PURE__ */ new Error("Health check timed out"));
|
|
24390
|
+
}, timeoutMs);
|
|
24327
24391
|
socket.on("data", (data) => {
|
|
24328
24392
|
buffer += data.toString();
|
|
24329
24393
|
const newlineIdx = buffer.indexOf("\n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/gateway",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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.8.0",
|
|
27
26
|
"@alfe.ai/ai-proxy-local": "^0.0.13",
|
|
27
|
+
"@alfe.ai/agent-api-client": "^0.8.0",
|
|
28
28
|
"@alfe.ai/config": "^0.3.0",
|
|
29
29
|
"@alfe.ai/integration-manifest": "^0.3.1",
|
|
30
|
-
"@alfe.ai/integrations": "^0.3.
|
|
30
|
+
"@alfe.ai/integrations": "^0.3.2",
|
|
31
31
|
"@alfe.ai/mcp-bundler": "^0.3.0"
|
|
32
32
|
},
|
|
33
33
|
"license": "UNLICENSED",
|