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
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import type { AvailableCategory, AvailableSkill } from "./agents/dynamic-agent-prompt-builder"
|
||||
import type { OhMyOpenCodeConfig } from "./config"
|
||||
import type { BrowserAutomationProvider } from "./config/schema/browser-automation"
|
||||
import type { LoadedSkill } from "./features/opencode-skill-loader/types"
|
||||
import type { PluginContext, ToolsRecord } from "./plugin/types"
|
||||
import type { Managers } from "./create-managers"
|
||||
|
||||
import { createAvailableCategories } from "./plugin/available-categories"
|
||||
import { createSkillContext } from "./plugin/skill-context"
|
||||
import { createToolRegistry } from "./plugin/tool-registry"
|
||||
|
||||
export type CreateToolsResult = {
|
||||
filteredTools: ToolsRecord
|
||||
mergedSkills: LoadedSkill[]
|
||||
availableSkills: AvailableSkill[]
|
||||
availableCategories: AvailableCategory[]
|
||||
browserProvider: BrowserAutomationProvider
|
||||
disabledSkills: Set<string>
|
||||
taskSystemEnabled: boolean
|
||||
}
|
||||
|
||||
export async function createTools(args: {
|
||||
ctx: PluginContext
|
||||
pluginConfig: OhMyOpenCodeConfig
|
||||
managers: Pick<Managers, "backgroundManager" | "tmuxSessionManager" | "skillMcpManager">
|
||||
}): Promise<CreateToolsResult> {
|
||||
const { ctx, pluginConfig, managers } = args
|
||||
|
||||
const skillContext = await createSkillContext({
|
||||
directory: ctx.directory,
|
||||
pluginConfig,
|
||||
})
|
||||
|
||||
const availableCategories = createAvailableCategories(pluginConfig)
|
||||
|
||||
const { filteredTools, taskSystemEnabled } = createToolRegistry({
|
||||
ctx,
|
||||
pluginConfig,
|
||||
managers,
|
||||
skillContext,
|
||||
availableCategories,
|
||||
})
|
||||
|
||||
return {
|
||||
filteredTools,
|
||||
mergedSkills: skillContext.mergedSkills,
|
||||
availableSkills: skillContext.availableSkills,
|
||||
availableCategories,
|
||||
browserProvider: skillContext.browserProvider,
|
||||
disabledSkills: skillContext.disabledSkills,
|
||||
taskSystemEnabled,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user