File size: 732 Bytes
f778c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import type { OpenClawConfig } from "../../config/types.openclaw.js";
export type GatewayRunRuntimeHooks = {
releaseManagedProxy?: () => Promise<void> | void;
refreshManagedProxy?: (config: OpenClawConfig["proxy"]) => Promise<void> | void;
};
let activeGatewayRunRuntimeHooks: GatewayRunRuntimeHooks = {};
export function getGatewayRunRuntimeHooks(): GatewayRunRuntimeHooks {
return activeGatewayRunRuntimeHooks;
}
export function installGatewayRunRuntimeHooks(hooks: GatewayRunRuntimeHooks): () => void {
const previous = activeGatewayRunRuntimeHooks;
activeGatewayRunRuntimeHooks = hooks;
return () => {
if (activeGatewayRunRuntimeHooks === hooks) {
activeGatewayRunRuntimeHooks = previous;
}
};
}
|