feat: support plugin-managed hooks
This commit is contained in:
@@ -6,6 +6,8 @@ import type { AnyAgentTool } from "../agents/tools/common.js";
|
||||
import type { ChannelDock } from "../channels/dock.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import type { InternalHookHandler } from "../hooks/internal-hooks.js";
|
||||
import type { HookEntry } from "../hooks/types.js";
|
||||
import type { ModelProviderConfig } from "../config/types.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import type { WizardPrompter } from "../wizard/prompts.js";
|
||||
@@ -71,6 +73,13 @@ export type ClawdbotPluginToolOptions = {
|
||||
optional?: boolean;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginHookOptions = {
|
||||
entry?: HookEntry;
|
||||
name?: string;
|
||||
description?: string;
|
||||
register?: boolean;
|
||||
};
|
||||
|
||||
export type ProviderAuthKind = "oauth" | "api_key" | "token" | "device_code" | "custom";
|
||||
|
||||
export type ProviderAuthResult = {
|
||||
@@ -179,6 +188,11 @@ export type ClawdbotPluginApi = {
|
||||
tool: AnyAgentTool | ClawdbotPluginToolFactory,
|
||||
opts?: ClawdbotPluginToolOptions,
|
||||
) => void;
|
||||
registerHook: (
|
||||
events: string | string[],
|
||||
handler: InternalHookHandler,
|
||||
opts?: ClawdbotPluginHookOptions,
|
||||
) => void;
|
||||
registerHttpHandler: (handler: ClawdbotPluginHttpHandler) => void;
|
||||
registerChannel: (registration: ClawdbotPluginChannelRegistration | ChannelPlugin) => void;
|
||||
registerGatewayMethod: (method: string, handler: GatewayRequestHandler) => void;
|
||||
|
||||
Reference in New Issue
Block a user