openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
31 lines (30 loc) • 1.61 kB
JavaScript
import { m as resolveAgentWorkspaceDir } from "./agent-scope-config-DcbEhP0R.js";
import "./agent-scope-DbtJyKUL.js";
import { u as getActivePluginRegistry } from "./runtime-BL4wZfTq.js";
import { a as getPluginRuntimeGatewayRequestScope } from "./gateway-request-scope-BCMYlsDI.js";
import { $t as validateHooksStatusParams } from "./src-BiL5aQto.js";
import { t as resolveAgentIdOrRespondError } from "./agent-id-shared-MLgRqPvR.js";
import { t as assertValidParams } from "./validation-pzrlzFvo.js";
import { t as loadWorkspaceHookEntries } from "./workspace-Bxltjm5Q.js";
import { t as buildWorkspaceHookStatus } from "./hooks-status-DgAi22jb.js";
//#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 };