fix: auto-enable plugins on startup
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user