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,41 @@
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import type { PluginContext } from "./types"
|
||||
|
||||
import { createUnstableAgentBabysitterHook } from "../hooks"
|
||||
import type { BackgroundManager } from "../features/background-agent"
|
||||
|
||||
export function createUnstableAgentBabysitter(args: {
|
||||
ctx: PluginContext
|
||||
backgroundManager: BackgroundManager
|
||||
pluginConfig: OhMyOpenCodeConfig
|
||||
}) {
|
||||
const { ctx, backgroundManager, pluginConfig } = args
|
||||
|
||||
return createUnstableAgentBabysitterHook(
|
||||
{
|
||||
directory: ctx.directory,
|
||||
client: {
|
||||
session: {
|
||||
messages: async ({ path }) => {
|
||||
const result = await ctx.client.session.messages({ path })
|
||||
if (Array.isArray(result)) return result
|
||||
if (typeof result === "object" && result !== null) {
|
||||
return result
|
||||
}
|
||||
return []
|
||||
},
|
||||
prompt: async (promptArgs) => {
|
||||
await ctx.client.session.promptAsync(promptArgs)
|
||||
},
|
||||
promptAsync: async (promptArgs) => {
|
||||
await ctx.client.session.promptAsync(promptArgs)
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
backgroundManager,
|
||||
config: pluginConfig.babysitting,
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user