fix(gateway): split hook channel types

This commit is contained in:
Vincent Koc
2026-04-09 07:41:40 +01:00
parent 1801702ed9
commit ea54beb08a
3 changed files with 6 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ import path from "node:path";
import { CONFIG_PATH, type HookMappingConfig, type HooksConfig } from "../config/config.js";
import { importFileModule, resolveFunctionModuleExport } from "../hooks/module-loader.js";
import { normalizeOptionalString, readStringValue } from "../shared/string-coerce.js";
import type { HookMessageChannel } from "./hooks.js";
import type { HookMessageChannel } from "./hooks.types.js";
export type HookMappingResolved = {
id: string;

View File

@@ -2,7 +2,6 @@ import { randomUUID } from "node:crypto";
import type { IncomingMessage } from "node:http";
import { listAgentIds, resolveDefaultAgentId } from "../agents/agent-scope.js";
import { listChannelPlugins } from "../channels/plugins/index.js";
import type { ChannelId } from "../channels/plugins/types.js";
import type { OpenClawConfig } from "../config/config.js";
import { readJsonBodyWithLimit, requestBodyErrorToText } from "../infra/http-body.js";
import { normalizeAgentId, parseAgentSessionKey } from "../routing/session-key.js";
@@ -14,6 +13,7 @@ import {
import { normalizeMessageChannel } from "../utils/message-channel.js";
import { type HookMappingResolved, resolveHookMappings } from "./hooks-mapping.js";
import { resolveAllowedAgentIds } from "./hooks-policy.js";
import type { HookMessageChannel } from "./hooks.types.js";
const DEFAULT_HOOKS_PATH = "/hooks";
const DEFAULT_HOOKS_MAX_BODY_BYTES = 256 * 1024;
@@ -222,7 +222,7 @@ export type HookAgentDispatchPayload = Omit<HookAgentPayload, "sessionKey"> & {
const listHookChannelValues = () => ["last", ...listChannelPlugins().map((plugin) => plugin.id)];
export type HookMessageChannel = ChannelId;
export type { HookMessageChannel } from "./hooks.types.js";
const getHookChannelSet = () => new Set<string>(listHookChannelValues());
export const getHookChannelError = () => `channel must be ${listHookChannelValues().join("|")}`;

View File

@@ -0,0 +1,3 @@
import type { ChannelId } from "../channels/plugins/types.js";
export type HookMessageChannel = ChannelId;