598a4389d1
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
43 lines
995 B
TypeScript
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,
|
|
}
|
|
}
|