Spaces:
Paused
Paused
File size: 1,573 Bytes
fb4d8fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | export type HookInstallSpec = {
id?: string;
kind: "bundled" | "npm" | "git";
label?: string;
package?: string;
repository?: string;
bins?: string[];
};
export type OpenClawHookMetadata = {
always?: boolean;
hookKey?: string;
emoji?: string;
homepage?: string;
/** Events this hook handles (e.g., ["command:new", "session:start"]) */
events: string[];
/** Optional export name (default: "default") */
export?: string;
os?: string[];
requires?: {
bins?: string[];
anyBins?: string[];
env?: string[];
config?: string[];
};
install?: HookInstallSpec[];
};
export type HookInvocationPolicy = {
enabled: boolean;
};
export type ParsedHookFrontmatter = Record<string, string>;
export type Hook = {
name: string;
description: string;
source: "openclaw-bundled" | "openclaw-managed" | "openclaw-workspace" | "openclaw-plugin";
pluginId?: string;
filePath: string; // Path to HOOK.md
baseDir: string; // Directory containing hook
handlerPath: string; // Path to handler module (handler.ts/js)
};
export type HookSource = Hook["source"];
export type HookEntry = {
hook: Hook;
frontmatter: ParsedHookFrontmatter;
metadata?: OpenClawHookMetadata;
invocation?: HookInvocationPolicy;
};
export type HookEligibilityContext = {
remote?: {
platforms: string[];
hasBin: (bin: string) => boolean;
hasAnyBin: (bins: string[]) => boolean;
note?: string;
};
};
export type HookSnapshot = {
hooks: Array<{ name: string; events: string[] }>;
resolvedHooks?: Hook[];
version?: number;
};
|