mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 00:31:37 +00:00
fix: wire 9 unwired plugin hooks to core code (openclaw#14882) thanks @shtse8
Verified: - GitHub CI checks green (non-skipped) Co-authored-by: shtse8 <8020099+shtse8@users.noreply.github.com>
This commit is contained in:
@@ -41,6 +41,7 @@ import {
|
||||
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
||||
import { startDiagnosticHeartbeat, stopDiagnosticHeartbeat } from "../logging/diagnostic.js";
|
||||
import { createSubsystemLogger, runtimeForLogger } from "../logging/subsystem.js";
|
||||
import { getGlobalHookRunner } from "../plugins/hook-runner-global.js";
|
||||
import { runOnboardingWizard } from "../wizard/onboarding.js";
|
||||
import { startGatewayConfigReloader } from "./config-reload.js";
|
||||
import { ExecApprovalManager } from "./exec-approval-manager.js";
|
||||
@@ -558,6 +559,16 @@ export async function startGatewayServer(
|
||||
logBrowser,
|
||||
}));
|
||||
|
||||
// Run gateway_start plugin hook (fire-and-forget)
|
||||
{
|
||||
const hookRunner = getGlobalHookRunner();
|
||||
if (hookRunner?.hasHooks("gateway_start")) {
|
||||
void hookRunner.runGatewayStart({ port }, { port }).catch((err) => {
|
||||
log.warn(`gateway_start hook failed: ${String(err)}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const { applyHotReload, requestGatewayRestart } = createGatewayReloadHandlers({
|
||||
deps,
|
||||
broadcast,
|
||||
@@ -624,6 +635,20 @@ export async function startGatewayServer(
|
||||
|
||||
return {
|
||||
close: async (opts) => {
|
||||
// Run gateway_stop plugin hook before shutdown
|
||||
{
|
||||
const hookRunner = getGlobalHookRunner();
|
||||
if (hookRunner?.hasHooks("gateway_stop")) {
|
||||
try {
|
||||
await hookRunner.runGatewayStop(
|
||||
{ reason: opts?.reason ?? "gateway stopping" },
|
||||
{ port },
|
||||
);
|
||||
} catch (err) {
|
||||
log.warn(`gateway_stop hook failed: ${String(err)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (diagnosticsEnabled) {
|
||||
stopDiagnosticHeartbeat();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user