fix: auto-enable plugins on startup

This commit is contained in:
Peter Steinberger
2026-01-20 16:37:34 +00:00
parent 15c735de4d
commit 5c5745dee5
2 changed files with 51 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import {
readConfigFileSnapshot,
writeConfigFile,
} from "../config/config.js";
import { applyPluginAutoEnable } from "../config/plugin-auto-enable.js";
import { clearAgentRunContext, onAgentEvent } from "../infra/agent-events.js";
import { onHeartbeatEvent } from "../infra/heartbeat-events.js";
import { startHeartbeatRunner } from "../infra/heartbeat-runner.js";
@@ -182,6 +183,20 @@ export async function startGatewayServer(
);
}
const autoEnable = applyPluginAutoEnable({ config: configSnapshot.config, env: process.env });
if (autoEnable.changes.length > 0) {
try {
await writeConfigFile(autoEnable.config);
log.info(
`gateway: auto-enabled plugins:\n${autoEnable.changes
.map((entry) => `- ${entry}`)
.join("\n")}`,
);
} catch (err) {
log.warn(`gateway: failed to persist plugin auto-enable changes: ${String(err)}`);
}
}
const cfgAtStart = loadConfig();
setGatewaySigusr1RestartPolicy({ allowExternal: cfgAtStart.commands?.restart === true });
initSubagentRegistry();