mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 16:30:42 +00:00
fix(plugins): split hook runner registry types
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
import { formatErrorMessage } from "../infra/errors.js";
|
||||
import { concatOptionalTextSegments } from "../shared/text/join-segments.js";
|
||||
import type { PluginRegistry } from "./registry.js";
|
||||
import type { GlobalHookRunnerRegistry, HookRunnerRegistry } from "./hook-registry.types.js";
|
||||
import type {
|
||||
PluginHookAfterCompactionEvent,
|
||||
PluginHookAfterToolCallEvent,
|
||||
@@ -184,7 +184,7 @@ type SyncHookResult<K extends SyncHookName> = ReturnType<SyncHookHandler<K>>;
|
||||
* Get hooks for a specific hook name, sorted by priority (higher first).
|
||||
*/
|
||||
function getHooksForName<K extends PluginHookName>(
|
||||
registry: PluginRegistry,
|
||||
registry: HookRunnerRegistry,
|
||||
hookName: K,
|
||||
): PluginHookRegistration<K>[] {
|
||||
return (registry.typedHooks as PluginHookRegistration<K>[])
|
||||
@@ -193,7 +193,7 @@ function getHooksForName<K extends PluginHookName>(
|
||||
}
|
||||
|
||||
function getHooksForNameAndPlugin<K extends PluginHookName>(
|
||||
registry: PluginRegistry,
|
||||
registry: HookRunnerRegistry,
|
||||
hookName: K,
|
||||
pluginId: string,
|
||||
): PluginHookRegistration<K>[] {
|
||||
@@ -203,7 +203,10 @@ function getHooksForNameAndPlugin<K extends PluginHookName>(
|
||||
/**
|
||||
* Create a hook runner for a specific registry.
|
||||
*/
|
||||
export function createHookRunner(registry: PluginRegistry, options: HookRunnerOptions = {}) {
|
||||
export function createHookRunner(
|
||||
registry: GlobalHookRunnerRegistry,
|
||||
options: HookRunnerOptions = {},
|
||||
) {
|
||||
const logger = options.logger;
|
||||
const catchErrors = options.catchErrors ?? true;
|
||||
const failurePolicyByHook = options.failurePolicyByHook ?? {};
|
||||
|
||||
Reference in New Issue
Block a user