openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
31 lines (30 loc) • 1.62 kB
JavaScript
import { a as getPluginRuntimeGatewayRequestScope } from "./gateway-request-scope-Btza1qbw.mjs";
import { d as resolveAgentWorkspaceDir } from "./agent-scope-config-BU4qc9bA.mjs";
import "./agent-scope-DWB4x52T.mjs";
import { l as getActivePluginRegistry } from "./runtime-zG-NbNbr.mjs";
import { un as validateHooksStatusParams } from "./src-D2gvuSyP.mjs";
import { t as loadWorkspaceHookEntries } from "./workspace-DtwjBExX.mjs";
import { t as buildWorkspaceHookStatus } from "./hooks-status-CCQSyUkI.mjs";
import { t as assertValidParams } from "./validation-B7TobU6-.mjs";
import { t as resolveAgentIdOrRespondError } from "./agent-id-shared-CCm6C9lW.mjs";
//#region src/gateway/server-methods/hooks-status.ts
/** Gateway handler for the live hook status report. */
const hooksStatusHandlers = { "hooks.status": ({ params, respond, context }) => {
if (!assertValidParams(params, validateHooksStatusParams, "hooks.status", respond)) return;
const config = context.getRuntimeConfig();
const resolved = resolveAgentIdOrRespondError({
rawAgentId: params.agentId,
respond,
cfg: config,
normalize: (value) => typeof value === "string" ? value.trim() || void 0 : void 0
});
if (!resolved) return;
const workspaceDir = resolveAgentWorkspaceDir(config, resolved.agentId);
const entries = [...(getPluginRuntimeGatewayRequestScope()?.pluginRegistry ?? getActivePluginRegistry())?.hooks.map((hook) => hook.entry) ?? [], ...loadWorkspaceHookEntries(workspaceDir, { config })];
respond(true, buildWorkspaceHookStatus(workspaceDir, {
config,
entries
}), void 0);
} };
//#endregion
export { hooksStatusHandlers };