Files
oh-my-opencode/src/plugin/hooks/create-core-hooks.ts
T
YeonGyu-Kim 9a027ddff8 refactor(core): split index.ts and config-handler.ts into focused modules
Main entry point:
- create-hooks.ts, create-tools.ts, create-managers.ts
- plugin-interface.ts: plugin interface types
- plugin/ directory: plugin lifecycle modules

Config handler:
- agent-config-handler.ts, command-config-handler.ts
- tool-config-handler.ts, mcp-config-handler.ts
- provider-config-handler.ts, category-config-resolver.ts
- agent-priority-order.ts, prometheus-agent-config-builder.ts
- plugin-components-loader.ts
2026-02-08 16:25:25 +09:00

43 lines
995 B
TypeScript

import type { HookName, OhMyOpenCodeConfig } from "../../config"
import type { PluginContext } from "../types"
import { createSessionHooks } from "./create-session-hooks"
import { createToolGuardHooks } from "./create-tool-guard-hooks"
import { createTransformHooks } from "./create-transform-hooks"
export function createCoreHooks(args: {
ctx: PluginContext
pluginConfig: OhMyOpenCodeConfig
isHookEnabled: (hookName: HookName) => boolean
safeHookEnabled: boolean
}) {
const { ctx, pluginConfig, isHookEnabled, safeHookEnabled } = args
const session = createSessionHooks({
ctx,
pluginConfig,
isHookEnabled,
safeHookEnabled,
})
const tool = createToolGuardHooks({
ctx,
pluginConfig,
isHookEnabled,
safeHookEnabled,
})
const transform = createTransformHooks({
ctx,
pluginConfig,
isHookEnabled: (name) => isHookEnabled(name as HookName),
safeHookEnabled,
})
return {
...session,
...tool,
...transform,
}
}