Files
wehub-resource-sync 3cd11ababe
Check Markdown links / linkChecker (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:38:56 +08:00

34 lines
919 B
TypeScript

export interface PluginContext {
[key: string]: any;
requestType?: 'complete' | 'chatComplete' | 'embed' | 'messages';
provider?: string;
metadata?: Record<string, any>;
}
export interface PluginParameters<K = Record<string, string>> {
[key: string]: any;
credentials?: K;
}
export interface PluginHandlerResponse {
error: any;
verdict?: boolean;
// The data object can be any JSON object or null.
data?: any | null;
transformedData?: any;
transformed?: boolean;
}
export type HookEventType = 'beforeRequestHook' | 'afterRequestHook';
export type PluginHandler<P = Record<string, string>> = (
context: PluginContext,
parameters: PluginParameters<P>,
eventType: HookEventType,
options?: {
env: Record<string, any>;
getFromCacheByKey?: (key: string) => Promise<any>;
putInCacheWithValue?: (key: string, value: any) => Promise<any>;
}
) => Promise<PluginHandlerResponse>;